Load from a stream

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 →

When the source document is not a file on disk (e.g., downloaded from a network, read from a database, or received as an upload), you can pass an InputStream directly to the MarkdownConverter constructor.

The stream is copied internally, so you may close it immediately after creating the converter. A multi-resource try-with-resources block closes both in the right order:

import com.groupdocs.markdown.*;

import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;

public class LoadStreamExample {

    public static void main(String[] args) throws IOException {
        try (InputStream stream = new FileInputStream("business-plan.docx");
             MarkdownConverter converter = new MarkdownConverter(stream)) {

            converter.convert("load-stream-example.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

Stream with LoadOptions

If the stream does not have a file extension for automatic format detection, specify the format explicitly via LoadOptions:

import com.groupdocs.markdown.*;

import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;

public class LoadStreamOptions {

    public static void main(String[] args) throws IOException {
        LoadOptions loadOptions = new LoadOptions(FileFormat.DOCX);

        try (InputStream stream = new FileInputStream("document");
             MarkdownConverter converter = new MarkdownConverter(stream, loadOptions)) {

            converter.convert("load-stream-options.md");
        }
    }
}
| ![Woman with laptop and business documents](data:...;base64,[elided])**HOME BASED** |  |  |
| --- | --- | --- |
|  |  |  |
| **PROFESSIONAL SERVICES** |  |  |
|  | ***Business Plan*** |  |



- Introduction
- 1.	Executive Summary
[TRUNCATED]

Download full output