Some test text!


WebViewer Server

In this document
chevron_rightGetting started
chevron_rightSetting up the server
chevron_rightAccessing the demo
chevron_rightWebViewer integration
chevron_rightAdvanced Configuration
chevron_rightServer authentication
chevron_rightSSL Config
chevron_rightMultiple backends
chevron_rightBrowser support

WebViewer Server is a drop-in backend for WebViewer that offers responsive viewing and compatibility across all client platforms (including mobile), along with scaling performance that approaches purely client-side solutions. It works hand-in-hand with WebViewer on the client, initially serving images then transitioning to client-side rendering.

linkGetting started

linkSetting up the server

  1. The server sample uses Docker technology, which requires Windows 10, Windows Server 2016, or a Linux distribution. In theory, any system is sufficient as long as Docker can be installed. Install the appropriate package from
  1. An evaluation or commercial license key is required to run WebViewer Server. If you are evaluating this product and do not have a key, please obtain one, and then visit this page via the link included in the trial email. If your company has licensed PDFTron then you already received your key in an email from See sign in for more details.
  2. Start the server Open a command line, navigate to the directory of the unpacked archive and call:

    docker-compose up

    You should be up and running at this point.

linkAccessing the demo

Once the server is running, the demo viewer app is accessible at http://localhost:8090/demo/?s

linkWebViewer integration

Once the docker container is up-and-running, then it can be used by supplying the pdftronServer argument to WebViewer upon startup:

options.pdftronServer = 'http://localhost:8090/';
var myWebViewer = new PDFTron.WebViewer(options, viewerElement);

Please see Getting started on the client for a more in depth look at how to set up WebViewer on the client side.

linkAdvanced Configuration

linkServer authentication

When a document URL is provided to WebViewer, that URL will now be fetched by the docker server instead of the browser. If authorization information needs to be provided to the server providing the document, this can be done using the customHeaders option when creating a document.

You can also provide the filename option to ensure that the server knows what type of file you are attempting to view (in case it is not clear from the URL).

options.customHeaders = {Cookie: "MYAUTHTOKEN=BF6CF50AB90C4025"};
options.filename = "Document.pdf";
var url = 'http://<documentserver>/FileDownload?param1=abcd&fetchid=dcba';
myWebViewer.loadDocument(url, options);

When the docker server makes a request to fetch http://<documentserver>/FileDownload?param1=abcd&fetchid=dcba, the http request will include the values in options.customHeaders.

linkSSL Config

The WebViewer server comes with a self-signed certificate, usable for debugging purposes only.

In order to have it work correctly on your own domain you must provide a signed certificate file. This signed certificate file should contain within it a public certificate, an optional intermediary certificate and a private key in the pem format. The private key must not have an associated password. If you do not include an intermediary certificate in this file, there may be issues with SSL on Firefox.

This combined certificate file should be located within haproxy/ and the SSL_CHAIN variable in the docker-compose.yml file should be set to the name of your certificate file.

linkMultiple backends

The container (along with webviewer) now has built-in support for using multiple backends behind a load balancer.

As the container is not entirely stateless, the balancer needs to fulfill a few requirements:

  • operates at layer 7 (http)
  • supports instance affinity ("stickiness") via cookies.
  • supports http health checks at a specific path

There is a sample configuration included in the download archive which demonstrates a fully working load balancer setup. Running docker-compose -f docker-compose_load_balance.yml up will launch a container composed of two WebViewer Server nodes with an HAProxy load balancer front end.

In the sample setup, incoming connections are directed to the least occupied backend node, and will remain attached to that node for the remainder of the session, or until the node starts to become overloaded.

If there are no available healthy nodes, then WebViewer will attempt to continue in client-only rendering mode.

linkBrowser support

ChromeFirefoxSafariEdgeInternet ExplorerAndroid ChromeMobile Safari