Save image as file

Use ExportImagesToFileSystemStrategy to save images as separate files during conversion. The Markdown output will contain image references pointing to the exported files.

Basic usage

using GroupDocs.Markdown;

var options = new ConvertOptions
{
    ImageExportStrategy = new ExportImagesToFileSystemStrategy("output/images")
};

MarkdownConverter.ToFile("business-plan.pdf", "output/document.md", options);

business-plan.pdf is a sample file used in this example. Click here to download it.

output/document.md (7 KB)
output/images/img-001.png (3 KB)
output/images/img-002.jpg (73 KB)
output/images/img-003.jpg (76 KB)

Download full output

Using ImagesRelativePath

By default, image references in the Markdown use the full ImagesFolder path. Set ImagesRelativePath to produce portable, relative image links:

using GroupDocs.Markdown;

var strategy = new ExportImagesToFileSystemStrategy("output/images")
{
    ImagesRelativePath = "images"
};

var options = new ConvertOptions
{
    ImageExportStrategy = strategy
};

MarkdownConverter.ToFile("business-plan.pdf", "output/document.md", options);

// Markdown output contains: ![](images/img-001.png)
// Image file saved to:     output/images/img-001.png

business-plan.pdf is a sample file used in this example. Click here to download it.

output/document.md (7 KB)
output/images/img-001.png (3 KB)
output/images/img-002.jpg (73 KB)
output/images/img-003.jpg (76 KB)

Download full output