Skip to end of metadata
Go to start of metadata
Contents Summary

This feature is supported since version 19.1 and it works only for email documents in version 19.1. Support for including/excluding fonts into/from HTML has been added for Presentation documents and Scalable Vector Graphics since this version.

Please note that, currently, not all document types support adding fonts into HTML, but we are planning to extend this feature to work with every document where it is applicable in the upcoming releases.

The code uses some of the objects defined in: Working with Common Operations.

Excluding Fonts when Rendering to HTML 

When we are rendering documents into HTML, by default the fonts that are used in the document are added to HTML content. This ensures fonts availability so that you can be pretty sure that the text from the original document will appear similar in the HTML, regardless of whether the fonts are installed on the viewer's device or not. Depending on IsResourceEmbedded option of HtmlOptions class the fonts are added inline as base64-encoded fonts or as external resources. 

The following document types support adding fonts into HTML: 

Format Name

Extension

Portable Document Format

PDF

Microsoft Word

DOC, DOCX, DOCM, DOT, DOTX, DOTM

Microsoft Outlook

MSG, EML

Apple MailEMLX

OpenDocument Formats

ODT, OTT

Rich Text Format

RTF

Electronic publication

EPUB

Mobipocket e-book format

MOBI

LaTeXTEX (since 19.1)

Microsoft PowerPoint

PPT, PPTX, PPS, PPSX

OpenDocument FormatsODP
Image filesSVG 

Embedded fonts increase the size of the rendering result. In order to prevent adding fonts into HTML, set ExcludeFonts property of HtmlOptions class as true as shown in the code sample below: 

Setting List of the Fonts to be Excluded

Adding fonts into HTML comes with the cost of the increased size of the output file. Therefore, GroupDocs.Viewer API provides a new setting - HtmlOptions.ExcludeFontsList, that allows finding the compromise, by preventing adding specific fonts (that are commonly available on most of the devices). The code sample below shows how to prevent adding fonts into output HTML. Currently, it works only for Presentation documents only. However, the support for this feature will be extended for all document types where it is applicable in the upcoming releases.

The following code sample shows how to set fonts list to be excluded.

Labels
  • No labels