Defines a strategy for handling image export during document-to-Markdown conversion. Implement this interface to control where and how images extracted from the source document are stored.
The library ships with several built-in strategies:
Implement this interface directly when none of the built-in strategies meet your needs.
Example:
public class CloudImageExportStrategy implements IImageExportStrategy {
@Override
public String getImagesFolder() {
return "cloud-images";
}
@Override
public OutputStream getImageStream(ImageExportContext context) {
context.setImageFileName("doc-" + context.getImageFileName());
return new ByteArrayOutputStream(); // replace with your cloud upload stream
}
}
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.
Returns:
java.io.OutputStream - a writable stream where the image data will be written, or null to use the default behavior
Was this page helpful?
Any additional feedback you'd like to share with us?
Please tell us how we can improve this page.
Thank you for your feedback!
We value your opinion. Your feedback will help us improve our documentation.