public class ExportImagesToFileSystemStrategy extends Object implements IImageExportStrategy
This strategy saves all images from the source document to a specified folder on the file system.
The images are saved with their original filenames as provided by the ImageExportContext.
If the specified images folder does not exist, it will be created automatically.
Example:
MarkdownConversionOptions options = new MarkdownConversionOptions();
options.setImageExportStrategy(new ExportImagesToFileSystemStrategy("output/images"));
// Convert document and save images to the specified folder
String markdown = MarkdownConverter.convert("document.docx", options);
// Images will be saved to the "output/images" folder
// and referenced in the markdown as 
| Constructor and Description |
|---|
ExportImagesToFileSystemStrategy(String imagesFolder)
Initializes a new instance of the
ExportImagesToFileSystemStrategy class. |
ExportImagesToFileSystemStrategy(String imagesFolder,
String markdownImagesFolder)
Initializes a new instance of the
ExportImagesToFileSystemStrategy class. |
| Modifier and Type | Method and Description |
|---|---|
String |
getImagesFolder()
Gets the folder where images will be exported.
|
OutputStream |
getImageStream(ImageExportContext context)
Gets a stream for writing the exported image to the file system.
|
String |
getMarkdownImagesFolder()
Gets the image path for the Markdown file
|
public ExportImagesToFileSystemStrategy(String imagesFolder)
ExportImagesToFileSystemStrategy class.imagesFolder - The folder where images will be exported.IllegalArgumentException - if imagesFolder is null or empty.public ExportImagesToFileSystemStrategy(String imagesFolder, String markdownImagesFolder)
ExportImagesToFileSystemStrategy class.imagesFolder - The folder where images will be exported.markdownImagesFolder - The image folder for markdown image urls.IllegalArgumentException - if imagesFolder is null or empty.public String getImagesFolder()
getImagesFolder in interface IImageExportStrategypublic OutputStream getImageStream(ImageExportContext context) throws IOException
getImageStream in interface IImageExportStrategycontext - The image export context containing information about the image being processed.IOException - if the file cannot be created or opened for writing.
If the images folder does not exist, it will be created automatically.
The image will be saved with the filename specified in the context.
public String getMarkdownImagesFolder()
Copyright © 2026. All rights reserved.