IImageExportStrategy

IImageExportStrategy interface

Defines the interface for handling image export during document conversion to Markdown. Implement this interface to customize how images are exported from source documents.

public interface IImageExportStrategy

Properties

Name Description
ImagesFolder { get; } Gets the folder where exported images will be stored.

Methods

Name Description
GetImageStream(ImageExportContext) Gets a stream for writing the exported image.

Remarks

This interface provides methods to control the image export process during document conversion. You can implement this interface to customize where images are stored and how they are processed.

Examples

The following example shows how to implement a custom image export strategy:

public class CustomImageExportStrategy : IImageExportStrategy
{
    public string ImagesFolder => "images";

    public Stream GetImageStream(ImageExportContext context)
    {
        // Optionally customize the image filename
        context.ImageFileName = "custom-" + context.ImageFileName;
        
        // Create and return a stream for the image
        return File.Create(ImagesFolder + "/" + context.ImageFileName);
    }
}

See Also