Some test text!
The PDFTron Docker image is provided prebuilt and hosted through Dockerhub. This guide will go through using the prebuilt image and configuring a built image.
Prior to using this guide, your device should have Docker installed.
PDFTron offers the WebViewer Server container image and the load balancer built for WebViewer Server on DockerHub as an alternative to the manually built package available on our website. Run the following in your commands prompt/terminal interface to get started with WebViewer.
This command will pull and run the WebViewer Server image. Ensure you are using Linux Containers before running this command.
docker run -p 8090:8090 -e INCLUDE_DEMO='true' -d -e TRN_PDFNET_KEY=your_demo_key pdftron/webviewer-server:latest
The settings for the containers are controlled by environment variables. These can be specified by
-e [VARIABLE]=[VALUE] when calling
docker run or set inside of the
docker-compose.yml available directly from our website.
Boolean variables should be surrounded by single quotes when used in the environment variable, such as
The following are the variables available for webviewer-server
TRN_PDFNET_KEY: String. Your PDFTron license key.
INCLUDE_DEMO: 'true' or 'false'. If set to true, the demo application is included with the server.
TRN_MAX_CACHE_AGE_MINUTES: Number. Sets the max cache age.
TRN_MAX_CACHE_MB: Number. Sets the maximum cache size in megabytes.
TRN_DEBUG_MODE: 'true' or 'false'. Makes logging more verbose and enables crash hooks.
TRN_ENABLE_SESSION_AUTH: 'true' or 'false'. If set to true, documents expire as soon as a user session terminates.
TRN_FETCH_DOWNGRADE_HTTPS: 'true' or 'false'. Forces all fetches to be downgraded to HTTP if true.
TRN_DISABLE_CLIENT_PDF_ACCESS: 'true' or 'false'. If set to true, will prevent the server from sending the PDF directly to the client, preferring other display modes instead (like server-side image rendering or .xod). Intended to protect sensitive documents by ensuring that only derived data (like rendered pages) are ever sent to the client.
The following are the variables available for wv-loadbalancer.
INITIAL_NODE_P: Sets a node for HAProxy to load balance to, the variables can be named between the letters A and P for a max of 16 servers. The names passed to these node variables should equal the container names of any webviewer-servers that were started. If we have 2 containers named
wv-serverB then the load balancer should be run with these arguments:
-e INITIAL_NODE_A=wv-serverA -e INITIAL_NODE_B=wv-serverB
ENABLE_TCP_MANAGEMENT: 'true' or 'false'. If set to true, enables the TCP management socket at port 4893. This socket allows full control of the load balancer through TCP. If enabled, the port 4893 must not be enabled past your internal network to ensure security. Read more about HAProxy dynamic management here.
DISABLE_SSL: 'true' or 'false'. If set to true, disables HTTPs socket binding on the balancer. Useful in situations where the load balancer does not need to control SSL connections.
URL_PREFIX: 'true' or 'false'. Sets a URL prefix for accessing the server.
Most cloud services which support containers will able to pull these images into their infrastructure to make deploying easy. This is often done by passing the registry name
pdftron/webviewer-server:latest to the configuration of the infrastructure. We recommend those using the Docker image registry to use a versioned copy of the image, such as
pdftron/webviewer-server:1.1 to prevent any breaking changes to their infrastructure.
We also provide a load balancer which can attach to multiple Webviewer Servers on DockerHub. This load balancer will allow you to run multiple WebViewer Servers from one access point. Multiple WebViewer Servers can be attached to one load balancer by appending additional nodes to it through the INITIAL NODE argument and starting each WebViewer Server to match these INITIAL NODE names. Below is an example of how to do so.
docker network create wv-network docker run --net wv-network -d -e INCLUDE_DEMO='true' -e TRN_PDFNET_KEY=your_demo_key --name webviewer-serverA pdftron/webviewer-server:latest docker run --net wv-network -d -e INCLUDE_DEMO='true' -e TRN_PDFNET_KEY=your_demo_key --name webviewer-serverB pdftron/webviewer-server:latest docker run --net wv-network -p 8090:8050 -d -e INITIAL_NODE_A=webviewer-serverA -e INITIAL_NODE_B=webviewer-serverB pdftron/wv-loadbalancer:latest