By default, GroupDocs.Viewer embeds the fonts used in the document into HTML. This ensures correct display regardless of the required fonts existing on the viewer device. Depending on the type of HTML rendering, fonts are added as follows:
Embedding fonts increase the size of the rendered result. To prevent adding fonts that are available on most devices to HTML, add the font names to the getFontsToExclude collection of the HtmlViewOptions class.
The following code snippet shows how to prevent adding the Times New Roman font to HTML.
importcom.groupdocs.viewer.Viewer;importcom.groupdocs.viewer.options.HtmlViewOptions;// ...
try(Viewerviewer=newViewer("sample.docx")){HtmlViewOptionsviewOptions=HtmlViewOptions.forEmbeddedResources();viewOptions.getFontsToExclude().add("Times New Roman");viewer.view(viewOptions);}
List of format families that support adding fonts to HTML
The following source file formats support adding fonts to HTML:
Format Name
Extension
Portable Document Format
PDF
Microsoft Word
DOC, DOCX, DOCM, DOT, DOTX, DOTM
Microsoft Outlook
MSG, EML
Apple Mail
EMLX
OpenDocument Formats
ODT, OTT
Rich Text Format
RTF
Electronic publication
EPUB
Mobipocket e-book format
MOBI
LaTeX
TEX
Microsoft PowerPoint
PPT, PPTX, PPS, PPSX
OpenDocument Formats
ODP
Image files
SVG
Was this page helpful?
Any additional feedback you'd like to share with us?
Please tell us how we can improve this page.
Thank you for your feedback!
We value your opinion. Your feedback will help us improve our documentation.