PDFTron Server

In this document
chevron_rightGetting started
chevron_rightAccessing the demo
chevron_rightSSL Config

PDFTron 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.

Getting started

Setting 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 https://docs.docker.com/engine/installation/
  1. Download the WebViewer server package, and unpack the downloaded archive. If you have not yet received a trial license key this link will not be functional. Please request a trial key, then visit this page via the link in your trial key email.
  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.

Accessing the demo

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

WebViewer 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.

Advanced Configuration

Server 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.

SSL Config

The PDFTron 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 cert.crt, and a matching private key nopasskey.pem, both in standard PEM format. For the time being the private key must not have an associated password.

Both of these files should be placed into tomcat/conf within the docker container prior to starting it (replacing the existing files with the same name).