How to substitute missing font when converting presentations

In case your presentation document contains a font that is not installed into the system GroupDocs.Viewer will use a default font. GroupDocs.Viewer enables you to specify font substitution with DefaultFontName setting.

Font substitution

To set font substitution for missing fonts please use the following code:

When converting to HTML with embedded resources:

using (Viewer viewer = new Viewer("input.pptx"))
{
    HtmlViewOptions viewOptions = HtmlViewOptions.ForEmbeddedResources("output/html_embedded/p_{0}.html");
    viewOptions.DefaultFontName = "Times New Roman";
    viewer.View(viewOptions);
}

When converting to HTML with external resources:

using (Viewer viewer = new Viewer("input.pptx"))
{
    HtmlViewOptions viewOptions = HtmlViewOptions.ForExternalResources("output/html_external");
    viewOptions.DefaultFontName = "Times New Roman";
    viewer.View(viewOptions);
}

Output HTML with default font:

Output HTML with “Times New Roman” font:

When converting to PDF:

using (Viewer viewer = new Viewer("input.pptx"))
{
      PdfViewOptions viewOptions = new PdfViewOptions("output.pdf");
      viewOptions.DefaultFontName = "Times New Roman";
      viewer.View(viewOptions);
}

Output PDF with default font:

Output PDF with “Times New Roman” font:

More resources

View PowerPoint Files Online

Along with full-featured .NET library we provide simple but powerful free online Apps. View PPT, PPTX, and ODP presentations online with GroupDocs Viewer App.

GitHub Examples

You may easily run the code above and see the feature in action in our GitHub examples: