Load from a stream

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

Close
Loading

Analyzing your prompt, please hold on...

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