IImageExportStrategy

IImageExportStrategy interface

Defines a strategy for handling image export during document-to-Markdown conversion. Implement this interface to control where and how images extracted from the source document are stored.

public interface IImageExportStrategy

Properties

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

Methods

Name Description
GetImageStream(ImageExportContext) Returns a writable stream for the image described by context. The library writes the image bytes to this stream during conversion.

Remarks

The library ships with several built-in strategies:

Implement this interface directly when none of the built-in strategies meet your needs.

Examples

Custom strategy that uploads images to cloud storage:

public class CloudImageExportStrategy : IImageExportStrategy
{
    public string ImagesFolder => "cloud-images";

    public Stream GetImageStream(ImageExportContext context)
    {
        // Rename the image file if needed
        context.ImageFileName = "doc-" + context.ImageFileName;

        // Return a stream that the library will write image bytes to
        return new MemoryStream(); // replace with your cloud upload stream
    }
}

See Also