WarningInfo.Source

WarningInfo Source property. Returns the source of the warning.

WarningInfo.Source property

Returns the source of the warning.

public WarningSource Source { get; }

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