CustomImagesStrategy
Leave feedback
On this page
Implements an image export strategy that gives you full control over how images are saved during conversion.
public class CustomImagesStrategy : IImageExportStrategy
| Name | Description |
|---|---|
| CustomImagesStrategy(string, IImageSavingHandler) | Initializes a new instance of the CustomImagesStrategy class. |
| Name | Description |
|---|---|
| ImagesFolder { get; } | Gets the physical folder where images will be saved on disk. |
| ImagesRelativePath { get; set; } | Gets or sets the path used in the Markdown image references. When null or empty, the full ImagesFolder path is used. Set this to a relative path (e.g. "images") for portable Markdown output. |
| Name | Description |
|---|---|
| GetImageStream(ImageExportContext) | Gets a stream for writing the exported image to the file system. |
Supply an IImageSavingHandler implementation to rename images, redirect them to a custom stream, or apply any other custom logic when each image is encountered.
Rename every image with a sequential prefix:
var handler = new RenameHandler();
var options = new ConvertOptions
{
ImageExportStrategy = new CustomImagesStrategy("images", handler)
};
string markdown = MarkdownConverter.ToMarkdown("document.docx", options);
- interface IImageExportStrategy
- namespace GroupDocs.Markdown
- assembly GroupDocs.Markdown
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.