HTML Converter
The URLConverter and Converter web services can be used to convert HTML content into PDF format.
| HTTP REST-API | OpenAPI |
|---|---|
POST /urlconverter | 🔗 |
POST /converter/{documentId} | 🔗 |
Both of these web services use the Chromium-Bridge for this purpose. Therefore, the Chromium bridge must be activated to use HTML conversion.
"URLConverter" Web Service​
The URLConverter web service allows you to retrieve and convert HTML documents from a URL (with "http://" oder "https://" protocol). When using the web service, the HTML content of the URL is retrieved and then converted to a PDF document.
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 10.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.
If a URL is to be converted via this endpoint, then it is specified as the parameter url in the parameters of the web service.
{
"urlconverter": {
"url": "https://www.webpdf.de",
"page": {
"bottom": 20,
"height": 287,
"left": 20,
"metrics": "mm",
"right": 20,
"top": 20,
"width": 210
}
}
}
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 processes HTML content that is available as a file or embedded in other formats, such as MSG or EML e-mail messages.
{
"converter": {
"jpegQuality": 100,
"mail": {
"adjustFonts": false,
"attachmentMode": "embed",
"downloadImages": false,
"ignoreMissingBodyChunk": false,
"reduceImageSize": false,
"resizeImages": false,
"resizeTables": false,
"useBackground": true
}
}
}
The downloadImages parameter can be used to specify whether externally referenced images should be downloaded when emails are converted.
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 10.0.2.
Conversion can be slowed down if downloadImages is enabled but the server does not have an external Internet connection. In this case, timeouts may slow down the conversion.
When converting HTML documents, these should define a <base href=""> to be able to fully resolve links.