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
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_KEYto enable API token-based authentication. See the Authentication guide for details.
API_AUTH_TOKENare 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
HTTPS_PROXY— A proxy server used for fetching remote documents.
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
pspdfkitdprocesses 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
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
PDF_GENERATION_TIMEOUT— This option sets the timeout in milliseconds for generating a PDF. Defaults to 20,000 milliseconds.