Set custom fonts

You can add custom font sources.

The following code snippet shows how to add a custom font source:

// Specify the font source.
FolderFontSource fontSource = new FolderFontSource(@"C:\custom_fonts", Fonts.SearchOption.TopFolderOnly);    
FontSettings.SetFontSources(fontSource);                       
 
using (Viewer viewer = new Viewer("sample.docx"))
{
    // Create an HTML file.
    HtmlViewOptions viewOptions = HtmlViewOptions.ForEmbeddedResources();
    viewer.View(viewOptions);
}