Pdf to Md

View as MarkdownMarkdown

Set up your AI agent

Give your coding agent live access to the GroupDocs documentation and API reference through the GroupDocs Docs MCP server — no install, no API key. Learn more

claude mcp add --transport http groupdocs-docs https://docs.groupdocs.com/mcp

Also process documents locally

The GroupDocs.Markdown MCP server lets your agent work with files on your machine; they are never uploaded. It needs the .NET 10 SDK or Docker.

claude mcp add groupdocs-markdown -- dnx GroupDocs.Markdown.Mcp --yes
Folders, licensing and more →

Use GroupDocs.Markdown to convert PDF documents to clean Markdown.

Using static method

The simplest way to convert a PDF file:

import com.groupdocs.markdown.*;

import java.io.File;

public class ExportPdfStatic {

    public static void main(String[] args) {
        // Set license (optional)
        if (new File("GroupDocs.Markdown.lic").exists()) {
            License.set("GroupDocs.Markdown.lic");
        }

        // Convert PDF to Markdown string
        String markdown = MarkdownConverter.toMarkdown("business-plan.pdf");

        // Or save directly to a file
        MarkdownConverter.toFile("business-plan.pdf", "export-pdf-static.md");
    }
}

business-plan.pdf is a sample file used in this example. Click here to download it.

**Meridian Outdoor Co. — Business Plan**

FY2026 Strategic Plan

![](data:...;base64,[elided])


**Table of Contents**

MeridianOutdoorCo.—BusinessPlan.........................................................................................1
[TRUNCATED]

Download full output

Using instance API with options

For more control, use the instance API:

import com.groupdocs.markdown.*;

import java.io.File;

public class ExportPdfInstance {

    public static void main(String[] args) {
        if (new File("GroupDocs.Markdown.lic").exists()) {
            License.set("GroupDocs.Markdown.lic");
        }

        try (MarkdownConverter converter = new MarkdownConverter("business-plan.pdf")) {
            ExportImagesToFileSystemStrategy strategy = new ExportImagesToFileSystemStrategy("images");
            strategy.setImagesRelativePath("images");

            DocumentConvertOptions options = new DocumentConvertOptions();
            options.setImageExportStrategy(strategy);
            options.setHeadingLevelOffset(1);

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

business-plan.pdf is a sample file used in this example. Click here to download it.

export-pdf-instance.md (7 KB)

Download full output

For the full list of input formats, see the supported formats page.