> For the complete documentation index, see [llms.txt](https://docs.apryse.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.apryse.com/web/get-started/faq/modifying-wvs.md).

# Modifying WebViewer Server

World's #1 PDF SDK Library for Web, Mobile, Server, Desktop

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.

{% tabs %}
{% tab title="Shell" %}
{% code lineNumbers="true" %}

```sh
FROM pdftron/webviewer-server:latest
COPY myfile.txt /
```

{% endcode %}
{% endtab %}
{% endtabs %}

{% tabs %}
{% tab title="Shell" %}
{% code lineNumbers="true" %}

```sh
docker build -t webviewer .
docker run webviewer
```

{% endcode %}
{% endtab %}
{% endtabs %}

The important paths within the server image are as follows:

* `/home/apryse`: This is the server which hosts the WebViewer Server code; it's where the bulk of work occurs.
* `/home/apryse/wv-server/static_data`: This is where we store WebViewer Server's cache.
* `/home/apryse/wv-server/internal_data/`: Where temporary data is stored, mainly used by Apryse core for memory swaps.
* `/home/apryse/wv-server/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.
* `/home/apryse/wv-server/logs`: Contains all logging data for WebViewer Server.

When WebViewer Server starts, it executes a script located in `/home/apryse/watchdog.sh`, this file is responsible for keeping Tomcat running inside of the container.

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

{% tabs %}
{% tab title="Bash" %}
{% code lineNumbers="true" %}

```bash
-Djava.library.path=/home/apryse/libs:/usr/lib/x86_64-linux-gnu
```

{% endcode %}
{% endtab %}
{% endtabs %}

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

{% tabs %}
{% tab title="Bash" %}
{% code lineNumbers="true" %}

```bash
JAVA_OPTS: '-Djava.library.path=/usr/lib:/home/apryse/lib:$CATALINA_HOME/bin:$CATALINA_HOME/lib:/usr/lib/x86_64-linux-gnu'
```

{% endcode %}
{% endtab %}
{% endtabs %}

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

{% tabs %}
{% tab title="Bash" %}
{% code lineNumbers="true" %}

```bash
JAVA_OPTS: '-Djava.library.path=/home/apryse/libs:/usr/lib/x86_64-linux-gnu -Xmx6G'
```

{% endcode %}
{% endtab %}
{% endtabs %}

The following documentation details more about these java options.

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

## Adding TTF and OTF Fonts

Adding custom TTF and OTF fonts to WebViewer Server is easy, although how to do so depends on how you are running it.

### When Running in a Container

#### Without Rebuilding

It is possible to add TTF and OTF fonts to WebViewer Server without rebuilding its container. To do so, mount your custom fonts as a volume to `/home/tomcat/.fonts/custom`. This can be done with docker-compose, as shown with the following line:

{% tabs %}
{% tab title="YAML" %}
{% code lineNumbers="true" %}

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

{% endcode %}
{% endtab %}
{% endtabs %}

You can replace `./myfonts` with whatever path contains your fonts.

Alternatively, this can also be done when running directly through Docker, like so:

{% tabs %}
{% tab title="Bash" %}
{% code lineNumbers="true" %}

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

{% endcode %}
{% endtab %}
{% endtabs %}

Similarly, `/home/user/myfonts` is a stand-in for the path to your fonts. Also, you should run your Docker setup with a clean start before you mount a volume.

#### With Rebuilding

You can also add TTF and OTF fonts by modifying the container image. You can replace `myfonts/` with whatever path contains your fonts.

{% tabs %}
{% tab title="Bash" %}
{% code lineNumbers="true" %}

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

{% endcode %}
{% endtab %}
{% endtabs %}

### When Installed with the Windows Installer

On Windows, you should install TTF and OTF fonts directly onto your system, and then restart WebViewer Server. [This](https://support.microsoft.com/en-us/office/add-a-font-b7c5f17c-4426-4b53-967f-455339c564c1/) guide from Microsoft goes into more detail on how this is done.

## Adding Other Types of Fonts

If a module you are running supports other types of fonts, such as SHX and RTF fonts for the CAD Module, it possible to add your own custom fonts for those modules to WebViewer Server.

### When Running in a Container

#### Without Rebuilding

To add module-specific fonts to WebViewer Server without rebuilding its container, mount your custom fonts as a volume to `/usr/local/apache-tomcat/fonts`. This can be done with docker-compose, as shown with the following line:

{% tabs %}
{% tab title="YAML" %}
{% code lineNumbers="true" %}

```yaml
volumes:
- ./myfonts:/home/apryse/fonts
```

{% endcode %}
{% endtab %}
{% endtabs %}

You can replace `./myfonts` with whatever path contains your fonts.

Alternatively, this can also be done when running directly through Docker, like so:

{% tabs %}
{% tab title="Bash" %}
{% code lineNumbers="true" %}

```bash
docker run -v /home/user/myfonts:/usr/local/apache-tomcat/fonts -p 8090:8090 pdftron/webviewer-server:latest
```

{% endcode %}
{% endtab %}
{% endtabs %}

Similarly, `/home/user/myfonts` is a stand-in for the path to your fonts. Also, you should run your Docker setup with a clean start before you mount a volume.

#### With Rebuilding

You can also add module-specific fonts to WebViewer Server by modifying its container image. `myfonts/` can be replaced with whatever path contains your custom fonts.

{% tabs %}
{% tab title="YAML" %}
{% code lineNumbers="true" %}

```yaml
FROM pdftron/webviewer-server:latest
COPY myfonts/ /home/apryse/fonts
```

{% endcode %}
{% endtab %}
{% endtabs %}

### When Installed with the Windows Installer

You must manually add module-specific fonts within your WebViewer Server directory on Windows. You can add your custom fonts to `\WebViewer-Server\apache-tomcat\fonts`, where `\WebViewer-Server` is your root directory for WebViewer Server. You may need to create the `\fonts` folder yourself.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.apryse.com/web/get-started/faq/modifying-wvs.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
