Skip to main content
Version: 10.0

Chromium engine

webPDF uses the Chromium engine (the base of the Chrome browser) to convert HTML content (e.g., in e-mail documents). The engine is integrated and managed with the Chromium Bridge. More specifically, webPDF starts the Chromium engine as a Chrome browser instance in a separate process when the server starts. The Chromium engine therefore appears as a Chrome process in the operating system (below the webPDF process). The webPDF server communicates with the Chrome browser instance via a socket connection.

The Chrome browser installation being used will be found in the chromium/ webPDF subdirectory. It is part of the installation and does not need to be deployed manually.

note

webPDF uses its own version of the Chrome browser and does not use any version that may already be installed on the operating system.

Web service usage​

The Chromium Bridge is used by the "Converter" and "URLConverter" web services.

The "Converter" web service uses the Chromium Bridge to directly convert HTML content, as well as to convert file formats that use HTML content internally. Examples include EML and MSG documents, as well as formatting for text content that requires more visual processing, such as text and source code documents.

The "URLConverter" web service converts the passed URL to a PDF document using the Chromium Bridge.

Locale and time zone​

The locale and the time zone of a conversion are applied to each page that Chromium loads: JavaScript in the page sees them (for example through Intl and Date), and the requests of the page carry an Accept-Language header with the locale. They come from the locale and timeZone attributes of the request or from the configured defaults; without a value, Chromium keeps the settings of its process environment. Limits and details are described under locale and time zone.

Browser starting port​

Using the admin page of the web services in the portal, the port of the browser can be adjusted under "Converter". If the value is 0, the browser will look for an available port itself when starting. If you want to set a specific port instead, you can use the "Port" setting to do so.

danger

If you disable the Chromium Bridge, it will not be possible to process any HTML content, meaning that certain file formats will no longer be converted and/or processed and that the web services will no longer work fully.

Self-healing of an unresponsive browser​

Since webPDF 10.0.7.

In rare cases the Chromium browser itself keeps answering, but every new page it opens hangs while loading. Before this behavior was added, every HTML conversion then failed after about 30 seconds with error code -160, until the server was restarted.

webPDF now detects this state. Each time a conversion opens a new page, the server counts a timeout when the page does not answer; an answered page resets the count. When the number of consecutive timeouts reaches the threshold (default: 3), the browser instance is replaced by a new one. Jobs that are still running on the replaced instance get time to finish before it is closed. If the replacement cannot be started, the server retries with an increasing delay. A single slow page under high load does not trigger a replacement, because the count must reach the threshold without one answered page in between. The jobs that run into the timeouts before the replacement still fail with -160.

The behavior is controlled by Environment Settings. The precedence is Environment Settings > XML configuration > defaults; these settings have no XML equivalent and are not shown in the Admin Portal. Setting names are not case-sensitive.

Environment variableSystem propertyDefaultValues and effect
WEBPDF_CHROMIUM_UNRESPONSIVE_ENABLED-Dwebpdf.chromium.unresponsive.enabledtruetrue or false. Set to false to switch the detection and replacement off and restore the previous behavior.
WEBPDF_CHROMIUM_UNRESPONSIVE_THRESHOLD-Dwebpdf.chromium.unresponsive.threshold3Integer of at least 1: number of consecutive timeouts when opening a new page after which the instance is replaced.
WEBPDF_CHROMIUM_HEALTH_ENABLED-Dwebpdf.chromium.health.enabledfalsetrue or false. Set to true to add the detail chromium to the health check /health/live.
WEBPDF_CHROMIUM_MAXUSAGEPERINSTANCE-Dwebpdf.chromium.maxUsagePerInstance0Number of jobs after which an instance is replaced. 0 or less switches the limit off.
WEBPDF_CHROMIUM_USEBACKUP-Dwebpdf.chromium.useBackupfalsetrue keeps a started backup instance that is switched to when the active one is replaced. Any other value is false.

An invalid value for unresponsive.enabled, unresponsive.threshold or health.enabled is reported as a warning in the log, and the default is used instead. The system properties -Dwebpdf.chromium.maxUsagePerInstance and -Dwebpdf.chromium.useBackup were already supported before; they now also exist as environment variables.

With WEBPDF_CHROMIUM_HEALTH_ENABLED=true, the health detail chromium of /health/live reports DOWN while the self-healing cannot provide a usable browser instance, that is, when a crashed, missing or unresponsive instance could not be replaced, or when the replacement of an unresponsive instance did not answer a page either. It reports UP again as soon as the active instance has answered a page without a timeout afterwards. Without conversions no pages are opened, so a DOWN state is only cleared by the next conversion that opens a page.