ExportImagesToFileSystemStrategy

Inheritance: java.lang.Object

All Implemented Interfaces: com.groupdocs.markdown.IImageExportStrategy

public class ExportImagesToFileSystemStrategy implements IImageExportStrategy

Saves images to a folder on disk during conversion.

By default, the Markdown output references images using the full imagesFolder path. Set imagesRelativePath to control the path that appears in the Markdown image links \u2014 typically a path relative to the output .md file.

Example:


 ExportImagesToFileSystemStrategy strategy =
     new ExportImagesToFileSystemStrategy("c:/output/images");

 strategy.setImagesRelativePath("images");

 ConvertOptions options = new ConvertOptions();
 options.setImageExportStrategy(strategy);

 MarkdownConverter.toFile("document.docx", "c:/output/doc.md", options);
 // Markdown: ![](../images/img-001.png)
 // File:     c:/output/images/img-001.png
 

Constructors

Constructor Description
ExportImagesToFileSystemStrategy(String imagesFolder) Initializes a new instance.

Methods

Method Description
getImagesFolder() Gets the physical folder where images will be saved on disk.
getImagesRelativePath() Gets or sets the path used in Markdown image references.
setImagesRelativePath(String imagesRelativePath)
getImageStream(ImageExportContext context) Gets a stream for writing the exported image to the file system.

ExportImagesToFileSystemStrategy(String imagesFolder)

public ExportImagesToFileSystemStrategy(String imagesFolder)

Initializes a new instance.

Parameters:

Parameter Type Description
imagesFolder java.lang.String physical folder where images will be saved

getImagesFolder()

public String getImagesFolder()

Gets the physical folder where images will be saved on disk.

Returns: java.lang.String

getImagesRelativePath()

public String getImagesRelativePath()

Gets or sets the path used in Markdown image references.

Returns: java.lang.String

setImagesRelativePath(String imagesRelativePath)

public void setImagesRelativePath(String imagesRelativePath)

Parameters:

Parameter Type Description
imagesRelativePath java.lang.String

getImageStream(ImageExportContext context)

public OutputStream getImageStream(ImageExportContext context)

Gets a stream for writing the exported image to the file system.

Parameters:

Parameter Type Description
context ImageExportContext

Returns: java.io.OutputStream