public class ExportImagesAsBase64Strategy extends Object implements IImageExportStrategy
This strategy converts all images to Base64 format and embeds them directly in the Markdown document using the data URI scheme. This eliminates the need for separate image files, making the Markdown document self-contained. However, this approach increases the size of the Markdown file and may not be supported by all Markdown viewers.
Example:
ConvertOptions options = new ConvertOptions();
options.setImageExportStrategy(new ExportImagesAsBase64Strategy());
String markdown = MarkdownConverter.toMarkdown("document.docx", options);
| Constructor and Description |
|---|
ExportImagesAsBase64Strategy() |
| Modifier and Type | Method and Description |
|---|---|
String |
getImagesFolder()
Returns an empty string since this strategy does not use an images folder.
|
OutputStream |
getImageStream(ImageExportContext context)
Returns null to indicate that the image should be embedded as Base64.
|
public String getImagesFolder()
getImagesFolder in interface IImageExportStrategypublic OutputStream getImageStream(ImageExportContext context)
getImageStream in interface IImageExportStrategycontext - The image export context containing the default image file name and other metadata.
You may modify imageFileName before returning the stream to change the file name
that appears in the Markdown output.null to use the default behaviorCopyright © 2026. All rights reserved.