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_rightCommon Issues
chevron_rightLinux Specific Issues
chevron_rightWindows Specific Issues
chevron_rightBrowser support
chevron_rightRunning on Cloud Services

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 https://docs.docker.com/engine/installation/
  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 team@pdftron.com. 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);

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.

linkCommon Issues

The container fails to start properly with the error Address is already bound.

  • This means you are already running the server or have another service bound to the port 8090. Run docker-compose down in any other directories you may have ran the server from and ensure nothing is using that port.

I'm running docker on a VM, but the WebViewer server is failing when building, specifically, when installing the debian packages in the build.

  • In this scenario, your VM likely does not have internet connectivity. Make sure you can contact the internet from your virtual machine.

linkLinux Specific Issues

When I try to use Docker on Linux it fails with permission errors.

  • Docker commands need to be run with sudo, do so for all the commands. It is possible to run without sudo, but requires extra user setup.

How do I run Docker without sudo?

  • Details on doing this can be found here.

linkWindows Specific Issues

When I try to build the Docker image with docker-compose up it fails with the message no matching manifest for unknown in the manifest list entries.

  • The docker files are trying to pull Linux only products, in order to build on Windows your Docker must be set to Use Linux Containers, this can be done by right clicking the Docker tray icon and selecting the Use Linux Containers option.

I want to run the WebViewer Server Docker container on a Windows VM, is this possible?

  • It's possible but depends on your own configuration and environment. WebViewer Server running on Windows uses a Virtual Machine through Docker in order to run Linux Containers, meaning nested virtualization must be enabled in your VM and the host machine.

My version of Windows does not support Hyper-V virtualization, how do I run WebViewer Server through Docker?

  • You can use the Docker toolbox which uses VirtualBox to handle virtualization.

I used Docker Toolbox to run WebViewer Server, but I find myself unable to connect to the server on localhost.

  • Open up a command prompt and type 'docker-machine ip', this should list the ip for the container. Use this ip to connect to the server rather than localhost.

linkBrowser support

ChromeFirefoxSafariEdgeInternet ExplorerAndroid ChromeMobile Safari
9+

linkRunning on Cloud Services