API Configuration for PDF Processor

While PSPDFKit Processor works out of the box, some parts need to be configured to work. Configuration options for the server are exposed via environment variables in your docker-compose.yml file.

  • LICENSE_KEY — This is the license key used to activate PSPDFKit Processor. If this isn’t specified or if it’s incorrect, PSPDFKit Processor won’t start up.

The following options concern authentication:

  • JWT_PUBLIC_KEY — This key has to correspond to the private key you’ll use when generating JSON Web Tokens (JWTs) in your app. See the Authentication guide for details.

  • JWT_ALGORITHM — This is the algorithm used for JWT verification. This should be the same as the one you’ll use for signing JWTs in your app. Supported algorithms: RS256, RS512, ES256, ES512. See RFC 7518 for details about specific algorithms.

  • API_AUTH_TOKEN — This can be set instead of JWT_PUBLIC_KEY to enable API token-based authentication. See the Authentication guide for details.

ℹ️ Note: JWT_PUBLIC_KEY and API_AUTH_TOKEN are mutually exclusive. If both are set, Processor will immediately shut down after being started.

There are also some optional configuration options:

  • PORT — The port PSPDFKit Processor is listening on. Defaults to 5000.

  • HTTP_PROXY or HTTPS_PROXY — A proxy server used for fetching remote documents.

  • STATSD_HOST and STATSD_PORT — Host and port of a running StatsD daemon that PSPDFKit Processor can report telemetry data to.

  • REMOTE_URL_FETCH_TIMEOUT — The timeout in ms applied when fetching documents from a remote URL. Defaults to 5,000 ms.

  • MAX_UPLOAD_SIZE_BYTES — The maximum size in bytes uploaded documents can be. This applies to all upload types, including remote documents. Defaults to 1,000,000,000 bytes, or about 950 MB.

  • LIBREOFFICE_CONVERSION_TIMEOUT — The timeout in ms applied when converting an Office document using LibreOffice. Any conversion taking longer than the configured timeout will fail. Defaults to 60,000 ms.

  • PSPDFKIT_WORKER_POOL_SIZE — This option controls how many pspdfkitd processes are started for handling PDF-related work. In general, setting this to two to three times the number of cores available will give you the best performance. Keep in mind that if you set this too high, the processes will starve each other for CPU time, leading to unnecessarily long processing times. And if you set this too low, available CPU time won’t be used efficiently, as tasks will have to wait for a long time for a worker to be available. This defaults to 16.

  • ALLOW_REMOTE_ASSETS_IN_GENERATION — This option controls whether PDF Generation will be able to access and fetch external resources, such as images or styles. This defaults to true.

  • PDF_GENERATION_TIMEOUT — This option sets the timeout in milliseconds for generating a PDF. Defaults to 20,000 milliseconds.