FontSourceBase.WarningCallback

FontSourceBase WarningCallback property. Called during processing of font source when an issue is detected that might result in formatting fidelity loss.

FontSourceBase.WarningCallback property

Called during processing of font source when an issue is detected that might result in formatting fidelity loss.

public IWarningCallback WarningCallback { get; set; }

Examples

Implementation of IWarningCallback to display warnings generated when reading font sources.

private class FontReadingWarningCallback : IWarningCallback
{
    public void Warning(WarningInfo info)
    {
        if (info.Source == WarningSource.Font)
        {
            Console.WriteLine(info.Description);
        }
    }
}

Demonstrates how to specify multiple font sources and generate warnings when reading fonts from these sources.

IWarningCallback fontReadingWarningCallback = new FontReadingWarningCallback();

FolderFontSource firstSource = new FolderFontSource(MyDir + "MyFonts", true);
firstSource.WarningCallback = fontReadingWarningCallback;
FolderFontSource secondSource = new FolderFontSource(MyDir + "MyFonts2", true);
secondSource.WarningCallback = fontReadingWarningCallback;

// Specify font setting for concrete document conversion operation.
ConverterContext context = new ConverterContext();
context.FontSettings = new FontSettings();
context.FontSettings.SetFontsSources(new FontSourceBase[] { firstSource, secondSource });

Converter.Create(context)
    .From(MyDir + "Simple.docx")
    .To(ArtifactsDir + "FontSubstitution.pdf")
    .Execute();

See Also