How to disable webfonts?

373 views
Skip to first unread message

Zing Zai

unread,
May 28, 2019, 12:17:54 PM5/28/19
to PDFTron WebViewer
PDFTron Web keeps getting fonts from 

Andy Huang

unread,
May 28, 2019, 3:56:19 PM5/28/19
to PDFTron WebViewer
Hi Zing,

WebViewer is getting the fonts from those URLs because it is falling back to the substitute fonts. This can occur when the document you are loading does not have the required fonts embedded in the document. You can workaround this by hosting the fonts on your own server. The self serve package can be downloaded here: http://pdftron.s3.amazonaws.com/downloads/SelfServeWebFonts.7z. The instructions can be found in the README.md file inside the package, however I will post the instructions here as well:

- WebViewer configuration
In order to serve fonts to webviewer, you should set the custom font URL within your config file using:

CoreControls.setCustomFontURL("https://www.somealternateurl.com/chosensubpath/");

- WebViewer Server configuration
The font server must be capable of serving via the HTTPS protocol. The fonts.json file and all the .css files should be placed into the same directory on the server (corresponding to the URL that was provided to setCustomFontURL above). Depending on the situation and the client version, WebViewer will fetch either fonts.json or the .css files directly, after which the font URLs will be read from the .css files. By default all the fonts will be served from www.pdftron.com/webfonts/. To change this, simply replace www.pdftron.com/webfonts/ with your own server in all the .css files.

It is also recommended to embed fonts in PDF documents to ensure they are portable and to avoid rendering issues.

Let me know if this helps!

Andy Huang
Software Developer
PDFTron Systems Inc.
Reply all
Reply to author
Forward
Message has been deleted
0 new messages