Save image by custom strategy
Leave feedback
This example demonstrates how to user control how images are saved when a document is saved to Markdown format.
AdvancedUsage.Strategy.CustomStrategy
using (var converter = new MarkdownConverter("example.pdf"))
{
var options = new DocumentConverterOptions
{
ImageExportStrategy = new CustomImagesStrategy("D:\\Images\\", RenameImageHandler),
};
converter.Convert("output.md", options);
}
int _index = 0;
private static void RenameImageHandler(CustomImageSavingArgs args)
{
args.SetOutputImageFileName($"rename_{_index}_{args.ImageFileName}");
_index++;
}
You may easily run the code above and see the feature in action in our GitHub examples:
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.