Convert documents to Markdown with GroupDocs.Markdown

GroupDocs.Markdown converts documents into structured Markdown — headings, lists, tables and images — that you can hand to a static site or a language model. MarkdownConverter reads the source and either returns a string or writes a .md file.

Import the package first, so the Total library is on the classpath, then load MarkdownConverter with java.import. Every example below is ready to copy into a project once you have installed the package.

Convert Word to Markdown

toFile writes the Markdown next to the name you give it. toMarkdown returns the same result as a string when you want to keep it in memory.

import '@groupdocs/groupdocs.total';
import java from 'java';

const MarkdownConverter = java.import('com.groupdocs.markdown.MarkdownConverter');

MarkdownConverter.toFile('business-plan.docx', 'markdown-word.md');

business-plan.docx is the 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

Images are embedded in the Markdown as Base64. The product guide shows how to write them to a folder instead, and how to pick GitHub Flavored Markdown or CommonMark.

Convert PDF to Markdown

The same call works for PDF. Only the source file changes.

import '@groupdocs/groupdocs.total';
import java from 'java';

const MarkdownConverter = java.import('com.groupdocs.markdown.MarkdownConverter');

MarkdownConverter.toFile('business-plan.pdf', 'markdown-pdf.md');

business-plan.pdf is the 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

Read document information

getInfo reports the format, page count and metadata without converting the file.

import '@groupdocs/groupdocs.total';
import java from 'java';

const MarkdownConverter = java.import('com.groupdocs.markdown.MarkdownConverter');

const info = MarkdownConverter.getInfo('business-plan.docx');

console.log('Format:    ' + info.getFileFormat());
console.log('Pages:     ' + info.getPageCount());
console.log('Title:     ' + info.getTitle());
console.log('Author:    ' + info.getAuthor());
console.log('Encrypted: ' + info.isEncrypted());

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

Format:    DOCX
Pages:     5
Title:     Meridian Outdoor Co. — Business Plan
Author:    Meridian Outdoor Co.
Encrypted: false

Download full output

Learn more

GroupDocs.Markdown also converts spreadsheets, presentations, email, ebooks and plain text, limits how many spreadsheet rows and columns are exported, shifts heading levels, and can add YAML front matter from the document metadata.

Close
Loading

Analyzing your prompt, please hold on...

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