Some test text!

menu
search
Free Trial Support

Contents

WebViewer configuration
Server configuration

Self serving substitute fonts

WebViewer will automatically use substitute fonts hosted on a web server when a font is not embedded in the document. The fallback fonts are hosted by PDFTron by default but if this is a concern, you can host the fonts on your own servers.

To get started, please download the self serve font package.

For LZMA compressed fonts, this package has those available but they will not work without the latest build of WebViewer.

The instructions below can also be found in the README.md file in the package.

linkWebViewer 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/");

See this guide for more details about config files.

linkServer configuration

The font server must be capable of serving via the HTTPS protocol.

fonts.json 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.

// OpenSans.css
@font-face {
    font-family: 'Open Sans';
    font-style: normal;
    font-weight: 300;
    src: local('Open Sans Light'), url(//www.somealternateurl.com/chosensubpath/OpenSansLight.ttf) format( 'truetype');
    src: local('Open Sans Light'), url(//www.somealternateurl.com/chosensubpath/OpenSansLight.ttf.brotli ) format('brotli truetype');
}

Get the answers you need: Support

Free Trial Support

Contents

WebViewer configuration
Server configuration
close

Free Trial

Get unlimited trial usage of PDFTron SDK to bring accurate, reliable, and fast document processing capabilities to any application or workflow.

Select a platform to get started with your free trial.

Unlimited usage. No email address required.