IImageSavingHandler

IImageSavingHandler interface

Callback interface invoked for each image encountered during conversion when using CustomImagesStrategy. Implement this interface to rename images, redirect output to a custom stream, or apply other custom logic.

public interface IImageSavingHandler

Methods

Name Description
Handle(CustomImageSavingArgs) Called once for each image found in the source document during conversion.

Examples

Rename images with a sequential prefix:

public class RenameHandler : IImageSavingHandler
{
    private int _index;

    public void Handle(CustomImageSavingArgs args)
    {
        args.SetOutputImageFileName($"img_{_index}_{args.ImageFileName}");
        _index++;
    }
}

See Also