Quick start guide

This guide shows you how to convert documents to Markdown with GroupDocs.Markdown for Java. You’ll have working code in under 2 minutes.

How it works

flowchart LR
    A["Input Document\n(DOCX, PDF, XLSX, EPUB, ...)"]
    B["MarkdownConverter"]
    C["Markdown Output\n(.md file or string)"]
    A --> B --> C

Prerequisites

  1. Add the GroupDocs repository and the dependency to your pom.xml (see Installation for Gradle, Kotlin, Ivy, and Sbt):
<repositories>
  <repository>
    <id>GroupDocs Artifact Repository</id>
    <url>https://releases.groupdocs.com/java/repo/</url>
  </repository>
</repositories>

<dependencies>
  <dependency>
    <groupId>com.groupdocs</groupId>
    <artifactId>groupdocs-markdown</artifactId>
    <version>latest-version</version>
  </dependency>
</dependencies>
  1. Import the package:
import com.groupdocs.markdown.*;

Example 1: Convert Word to Markdown

The simplest conversion — one line of code:

import com.groupdocs.markdown.*;

public class QsWordToMd {

    public static void main(String[] args) {
        // Convert a Word document to Markdown
        String markdown = MarkdownConverter.toMarkdown("business-plan.docx");

        // Or save directly to a file
        MarkdownConverter.toFile("business-plan.docx", "qs-word-to-md.md");
    }
}

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

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

**Meridian Outdoor Co. — Business Plan**

FY2026 Strategic Plan


# **Table of Contents**

FY2026 Strategic Plan	1
[TRUNCATED]

Download full output

Example 2: Convert PDF with image export

Save a PDF to Markdown with images extracted to a folder:

import com.groupdocs.markdown.*;

public class QsPdfWithImages {

    public static void main(String[] args) {
        ExportImagesToFileSystemStrategy strategy =
                new ExportImagesToFileSystemStrategy("output/images");
        strategy.setImagesRelativePath("images");

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

        MarkdownConverter.toFile("business-plan.pdf", "output/report.md", options);

        // Images saved to output/images/
        // Markdown references: ![](images/img-001.png)
    }
}

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

output/images/img-001.jpg (10 KB)
output/images/img-002.jpg (39 KB)
output/images/img-003.jpg (25 KB)
output/images/img-004.jpg (16 KB)
output/images/img-005.jpg (44 KB)
output/images/img-006.jpg (20 KB)
output/images/img-007.jpg (648 bytes)
output/images/img-008.jpg (48 KB)
output/report.md (7 KB)

Download full output

Example 3: Convert Excel with options

Convert a spreadsheet with column truncation and front matter:

import com.groupdocs.markdown.*;

public class QsExcelOptions {

    public static void main(String[] args) {
        DocumentConvertOptions options = new DocumentConvertOptions();
        options.setMaxColumns(8);
        options.setMaxRows(50);
        options.setIncludeFrontMatter(true);
        options.setFlavor(MarkdownFlavor.GITHUB);

        try (MarkdownConverter converter = new MarkdownConverter("cost-analysis.xlsx")) {

            // Inspect before converting
            DocumentInfo info = converter.getDocumentInfo();
            System.out.println("Worksheets: " + info.getPageCount());

            // Convert
            DocumentConvertResult result = converter.convert("qs-excel-options.md", options);

            // Check warnings
            for (String w : result.getWarnings()) {
                System.out.println("Warning: " + w);
            }
        }
    }
}

cost-analysis.xlsx is a sample file used in this example. Click here to download it.

---
format: XLSX
pages: 4
---


## Summary

| Category | FY2024 | FY2025 | FY2026 |
| --- | --- | --- | --- |
[TRUNCATED]

Download full output

What’s next?

Close
Loading

Analyzing your prompt, please hold on...

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