IImageExportStrategy
Contents
[
Hide
]
IImageExportStrategy interface
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.
public interface IImageExportStrategy
Properties
| Name | Description |
|---|---|
| ImagesFolder { get; } | Gets the folder path where exported images will be stored. |
Methods
| Name | Description |
|---|---|
| GetImageStream(ImageExportContext) | Returns a writable stream for the image described by context. The library writes the image bytes to this stream during conversion. |
Remarks
The library ships with several built-in strategies:
ExportImagesAsBase64Strategy– embeds images inline as Base64 (the default).ExportImagesToFileSystemStrategy– writes images to a folder on disk.SkipImagesStrategy– omits images entirely.CustomImagesStrategy– delegates to a callback you supply.
Implement this interface directly when none of the built-in strategies meet your needs.
Examples
Custom strategy that uploads images to cloud storage:
public class CloudImageExportStrategy : IImageExportStrategy
{
public string ImagesFolder => "cloud-images";
public Stream GetImageStream(ImageExportContext context)
{
// Rename the image file if needed
context.ImageFileName = "doc-" + context.ImageFileName;
// Return a stream that the library will write image bytes to
return new MemoryStream(); // replace with your cloud upload stream
}
}
See Also
- namespace GroupDocs.Markdown
- assembly GroupDocs.Markdown