Convert files to various formats

GroupDocs.Markdown provides a quick and easy way to convert documents into clean, structured Markdown. The library offers two approaches: static methods for one-line conversions and an instance API for more control.

Static methods (simplest)

Call MarkdownConverter.toMarkdown() to get a Markdown string, or MarkdownConverter.toFile() to write directly to disk:

import com.groupdocs.markdown.*;

public class StaticMethods {

    public static void main(String[] args) {
        String md = MarkdownConverter.toMarkdown("business-plan.docx");
        // # Quarterly Report
        //
        // ## Executive Summary
        //
        // This report covers the key initiatives...

        MarkdownConverter.toFile("business-plan.docx", "static-methods.md");
    }
}

Instance API

Create a MarkdownConverter instance for advanced scenarios such as inspecting metadata before converting or reusing a loaded document:

import com.groupdocs.markdown.*;

public class InstanceApi {

    public static void main(String[] args) {
        try (MarkdownConverter converter = new MarkdownConverter("business-plan.docx")) {
            DocumentConvertOptions options = new DocumentConvertOptions();
            options.setHeadingLevelOffset(1);

            converter.convert("instance-api.md", options);
        }
    }
}

Conversion options

Use DocumentConvertOptions to customize the output – select specific pages, control image handling, choose a Markdown flavor, add YAML front matter, and more. For loading customization, use LoadOptions to specify file format or provide a password.

These documentation articles explain how to convert files from the most popular formats:

Close
Loading

Analyzing your prompt, please hold on...

An error occurred while retrieving the results. Please refresh the page and try again.