Save image as base64

By default, DocumentConvertOptions uses ExportImagesAsBase64Strategy, which embeds images as Base64 data URIs directly in the Markdown output. This keeps the output self-contained in a single file with no external image dependencies.

Using static method

import com.groupdocs.markdown.*;

public class Base64Static {

    public static void main(String[] args) {
        // Default behavior -- images are embedded as Base64
        MarkdownConverter.toFile("business-plan.pdf", "base64-static.md");
    }
}

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

Specifying the strategy explicitly

If you want to be explicit, pass a new ExportImagesAsBase64Strategy to setImageExportStrategy:

import com.groupdocs.markdown.*;

public class Base64Explicit {

    public static void main(String[] args) {
        DocumentConvertOptions options = new DocumentConvertOptions();
        options.setImageExportStrategy(new ExportImagesAsBase64Strategy());

        try (MarkdownConverter converter = new MarkdownConverter("business-plan.pdf")) {
            converter.convert("base64-explicit.md", options);
        }
    }
}

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

Close
Loading

Analyzing your prompt, please hold on...

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