Loading specific file formats

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.Parser MCP server lets your agent work with files on your machine; they are never uploaded. It runs in Docker: replace /path/to/documents with the folder it may use.

claude mcp add groupdocs-parser -- docker run --rm -i -v /path/to/documents:/data ghcr.io/groupdocs-parser/parser-net-mcp:latest
Folders, licensing and more →

In some cases it’s required to specify the document format manually to guarantee correct output produced by GroupDocs.Parser. The following are the cases when the document format must be specified manually:

  • Markdown documents
  • MHTML documents
  • OTP documents (OpenDocument Presentation Template)
  • Databases
  • Emails from remote servers

Here are the steps to specify the document format for Markup document.

The following example shows how to specify the document format for Markup document:

try (InputStream stream = new FileInputStream(Constants.SampleMd)) {
    // Create an instance of Parser class for markdown document
    try (Parser parser = new Parser(stream, new LoadOptions(FileFormat.Markup))) {
        // Check if text extraction is supported
        if (!parser.getFeatures().isText()) {
            System.out.println("Text extraction isn't supported.");
            return;
        }
        try (TextReader reader = parser.getText()) {
            // Print the document text
            // Markdown is detected; text without special symbols is printed
            System.out.println(reader.readToEnd());
        }
    }
}

More resources

GitHub examples

You may easily run the code above and see the feature in action in our GitHub examples:

Free online document parser App

Along with full featured Java library we provide simple, but powerful free Apps.

You are welcome to extract data from PDF, DOC, DOCX, PPT, PPTX, XLS, XLSX, Emails and more with our free online Free Online Document Parser App.