Some test text!

Search
Hamburger Icon

Web / FAQ / Modifying WebViewer Server

Modifying WebViewer Server

It's possible to perform internal changes to WebViewer Server, though we do not recommend it. You may wish to do this if our options do not expose a particular configuration setting, such as the maximum allowed threads in Tomcat.

WebViewer Server Layout

This section will help you understand WebViewer Server. Below is how you would typically build on top of our existing container.

FROM pdftron/webviewer-server:latest
COPY myfile.txt /
docker build -t webviewer .
docker run webviewer

The important paths within the server image are as follows:


/usr/local/apache-tomcat: This is the server which hosts the WebViewer Server code, it is where the bulk of work occurs.

/usr/local/apache-tomcat/conf: This is the main configuration directory for tomcat, within you'll find 3 configuration files - server.xml, web.xml and context.xml. You may change this but do so at your own risk as we have configured these files specifically for WebViewer Server.

/usr/local/apache-tomcat/static_data: This is where we store WebViewer Server's cache.

/usr/local/apache-tomcat/internal_data/: Where temporary data is stored, mainly used by Apryse core for memory swaps.

/usr/local/apache-tomcat/webapps: This contains the blackbox and demo webapps. Prior to 1.5.6 this will contain Java classes, in any other version it will contain .war files containing the webapps.

/usr/local/apache-tomcat/logs: Contains all logging data for WebViewer Server.

When WebViewer Server starts, it executes a script located in /usr/local/apache-tomcat/bin/watchdog.sh, this file is responsible for keeping Tomcat running inside of the container.


For more information on configuring Tomcat, you can refer to their available guide for Tomcat 10 http://tomcat.apache.org/tomcat-10.0-doc/

Updating PDFNet

If you need to update WebViewer Server's core libraries, you can do so.

  1. Retrieve a different version of PDFNet from our downloads section or a provided link.
  2. Create a new Dockerfile with the following, and extract the PDFNet to the same directory as the Dockerfile. You should be using a Java version of our SDK.
FROM pdftron/webviewer-server:latest
COPY libPDFNetC.so /usr/local/apache-tomcat/bin/
COPY PDFNet.jar /usr/local/apache-tomcat/lib/

For Windows, you need to copy PDFNetC.dll to /install_dir/apache-tomcat/bin/.

  1. Start the server. You will now run with a new PDFNet, this can be confirmed in the logs.
21:43:32.773 INFO [main] com.pdftron.blackboxservlet.ContextListener.contextInitialized {"PDFNet_version":8.2077024,"num_cpu":4,"os_arch":"amd64","os_name":"Linux","os_version":"5.10.7-arch1-1","server_version":"1.5.4-g4c1f614","total_memory":32064}

Modifying JAVA_OPTS

Some customers may need to modify JAVA_OPTS, most likely to change memory values. This can be easily done by setting the JAVA_OPTS environment variable. Keep in mind the following must be in the JAVA_OPTS variable.

-Djava.library.path=/usr/lib:/usr/local/tcnative/lib:$CATALINA_HOME/bin:$CATALINA_HOME/lib:/usr/lib/x86_64-linux-gnu

In the docker-compose this would be defined like so:

JAVA_OPTS: '-Djava.library.path=/usr/lib:/usr/local/tcnative/lib:$CATALINA_HOME/bin:$CATALINA_HOME/lib:/usr/lib/x86_64-linux-gnu'

Java Memory

The main use for this is to modify Java memory limits. We recommend setting Xmx to a bit less than your server's available memory. This will prevent Java from exceeding allocation limits because it has not garbage collected.

JAVA_OPTS: '-Djava.library.path=/usr/lib:/usr/local/tcnative/lib:$CATALINA_HOME/bin:$CATALINA_HOME/lib:/usr/lib/x86_64-linux-gnu -Xmx6G'

The following documentation details more about these java options.

https://docs.oracle.com/javase/8/docs/technotes/tools/windows/java.html

Adding fonts

Without Rebuilding

Without rebuilding the container it is possible to add fonts. To do so you only need to mount your custom fonts as a volume to /home/tomcat/.fonts/custom. This can be done in docker-compose with the following volume line:

volumes:
- ./myfonts:/home/tomcat/.fonts/custom

Or when running directly through Docker like so:

docker run -v /home/user/myfonts:/home/tomcat/.fonts/custom -p 8090:8090 pdftron/webviewer-server:latest

You should be running your Docker setup from a clean start if this volume was mounted.

With Rebuilding

You can also add fonts by modifying the container image. The myfonts path should contain your fonts and they should either be in true type or open type formats.

FROM pdftron/webviewer-server:latest
COPY myfonts/*.ttf /usr/share/fonts/truetype
COPY myfonts/*.otf /usr/share/fonts/opentype
RUN fc-cache

With the Windows Installer

On windows you should install the fonts directly onto your system by double clicking them and then restarting the server. The guide below shows in more detail how this is done.

https://support.microsoft.com/en-us/office/add-a-font-b7c5f17c-4426-4b53-967f-455339c564c1

Trial setup questions? Ask experts on Discord
Need other help? Contact Support
Pricing or product questions? Contact Sales