CustomImagesStrategy
Contents
[
Hide
]
CustomImagesStrategy class
Implements an image export strategy that gives you full control over how images are saved during conversion.
public class CustomImagesStrategy : IImageExportStrategy
Constructors
| Name | Description |
|---|---|
| CustomImagesStrategy(string, IImageSavingHandler) | Initializes a new instance of the CustomImagesStrategy class. |
Properties
| 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. |
Methods
| Name | Description |
|---|---|
| GetImageStream(ImageExportContext) | Gets a stream for writing the exported image to the file system. |
Remarks
Supply an IImageSavingHandler implementation to rename images, redirect them to a custom stream, or apply any other custom logic when each image is encountered.
Examples
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);
See Also
- interface IImageExportStrategy
- namespace GroupDocs.Markdown
- assembly GroupDocs.Markdown