public class CustomImagesStrategy extends Object implements IImageExportStrategy
Supply an IImageSavingHandler implementation to rename images, redirect them to a
custom stream, or apply any other custom logic when each image is encountered.
Example:
IImageSavingHandler handler = new RenameHandler();
ConvertOptions options = new ConvertOptions();
options.setImageExportStrategy(new CustomImagesStrategy("images", handler));
String markdown = MarkdownConverter.toMarkdown("document.docx", options);
| Constructor and Description |
|---|
CustomImagesStrategy(String imagesFolder,
com.groupdocs.markdown.imageexport.IImageSavingHandler handler)
Initializes a new instance of the
CustomImagesStrategy class. |
| Modifier and Type | Method and Description |
|---|---|
com.groupdocs.markdown.imageexport.IImageSavingHandler |
getCustomHandler() |
String |
getImagesFolder()
Gets the physical folder where images will be saved on disk.
|
String |
getImagesRelativePath()
Gets or sets the path used in the Markdown image references.
|
OutputStream |
getImageStream(ImageExportContext context)
Gets a stream for writing the exported image to the file system.
|
void |
setImagesRelativePath(String imagesRelativePath) |
public CustomImagesStrategy(String imagesFolder, com.groupdocs.markdown.imageexport.IImageSavingHandler handler)
CustomImagesStrategy class.imagesFolder - the folder where images will be exportedhandler - the handler that is called for each image during conversionpublic String getImagesFolder()
getImagesFolder in interface IImageExportStrategypublic String getImagesRelativePath()
public void setImagesRelativePath(String imagesRelativePath)
public 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 behaviorpublic com.groupdocs.markdown.imageexport.IImageSavingHandler getCustomHandler()
Copyright © 2026. All rights reserved.