HTML conversion
The "URLConverter" and "Converter" web services make it possible to convert HTML content to PDF format.
API {REST}: /urlconverter
API {REST}: /converter
Both of these web services use the "Chromium” toolbox, version 105.0.5195, to do so. To use HTML conversion, the Chromium bridge must be enabled.
The external toolbox is located in the "chromium/" subdirectory found in webPDF's installation directory.
"URLConverter" Web Service
The "URLConverter" web service makes it possible to call HTML documents via a URL. When the web service is used, the URL’s HTML content is retrieved and converted to a PDF document with the toolbox.
The URLConverter web service does not support the file protocol (file://) in the URL.
For server security reasons and to avoid security vulnerabilities, access to local server resources is blocked via the file protocol. This is an important change since version 9.0.2 that may require adjustments to client applications. The corresponding resource must always be accessed via the http:// or https:// (recommended) protocol.
The "URLConverter" is primarily intended for URLs over which you have control in terms of content and structure, e.g., your own websites or applications. While any URL can be converted with the web service, this will not always yield an optimal output quality, since these URLs are often optimized for screens, but not for PDFs.
Comments:
- All external contents (images, scripts, etc.) will always be retrieved
- As of this writing, only the "Basic access authentication" authentication method is supported (please refer to URLConverter parameters)
"Converter" web service
The "Converter" web service uses the toolbox to convert HTML documents which are available as a file and to convert e-mails the content of which is defined based on HTML. This is the case, for example, with "MSG” or "EML" e-mail messages.
If the HTML content of an email contains links that are to be loaded using the file protocol (file://), these are blocked. For reasons of server security and to reduce potential attack vectors on the server, access to such resources has been blocked since version 9.0.2.
Comments:
- When converting e-mails, “downloading” all images is disabled as the “default,” i.e., only images embedded in the e-mail will be shown. This behaviour can be adjusted with the parameters for the "Converter” web service.
- HTML contents must define a
<base href="">in order to resolve links - For file-based HTML content, the option "baseURL" must be used to specify a base URL.
- In file-based HTML content, images are looked for as a URL relative to the file (except if a "baseURL" has been set).
- All images are downloaded for HTML documents
- Image downloads and font modifications apply only to the HTML content or embedded CSS code. Externally loaded CSS files (e.g. via "@import") are not modified.