Skip to main content
Version: 10.0

Document conversion

webPDF provides the Converter web service to convert file formats from third-party providers into PDF documents.

HTTP REST-APIOpenAPI
POST /converter/{documentId}πŸ”—

The server uses various native format converters integrated into the server and a number of external programs to create a PDF from various file formats.

While graphic formats such as PNG or JPEG are implemented by integrated format converters, webPDF uses different conversion paths for Office and other third-party formats. In webPDF 10, docx documents are converted by default with the native Word Converter. Other formats continue to use integrated external tools such as Outside In Technology, which are installed together with the server and do not need to be provided manually.

note

The external applications that are connected via β€œBridges” (e.g. β€œOffice Bridge”) are not part of webPDF and must be provided externally.

webPDF automatically detects formats, i.e., you do not have to specify the file type of the file to be converted. webPDF will not use the file extension as a basis when detecting formats but will use the file contents as a basis instead. When a format is recognized, it will be assigned to the corresponding "mime-type" and the appropriate converter will be called.

For Office formats, webPDF uses the following order:

  1. Office Bridge, if requested explicitly
  2. SharePoint Bridge, if requested explicitly
  3. Word Converter for docx
  4. Outside In Technology as the fallback

Locale and time zone​

The locale and timeZone attributes of the converter parameter node set the language and the clock of a conversion. They are optional. The URL Converter web service has the same two attributes in its urlconverter parameter node. Which of the two values a conversion path evaluates, and what it does with them, is listed per conversion path.

AttributeFormEffect
localeA language tag: language (2 or 3 letters), optionally followed by a script (4 letters) and a region (2 letters or 3 digits), separated by hyphens, for example de, en-US, sr-Latn-RS or es-419. Upper and lower case are both accepted.Formatting of numbers and dates, the language of text that has none of its own, the selection of a localized template, and the document language of the PDF (/Lang) of a document that states none.
timeZoneAn identifier known to the Java runtime of the server, such as Europe/Berlin or UTC, or a fixed offset in the form +hh:mm or -hh:mm (up to 18:00). Abbreviations such as EST are not accepted.The time zone in which the conversion reads the current date and time and in which it shows times.

A language that the document states itself always takes precedence; locale applies only where the document states none. Both values must be known to the Java runtime of the server: a well-formed value for which the runtime has no data, for example de-US, is rejected and is not mapped to a similar one.

{
"converter": {
"locale": "en-US",
"timeZone": "America/New_York"
}
}

Order of precedence​

For each of the two values separately, webPDF uses the first one that is set:

  1. The attribute of the request.
  2. The default of the web service: converter for the Converter web service, urlconverter for the URLConverter web service (see below). For a visual signature that is part of the conversion, the converter default applies, not the one of the Signature web service.
  3. The default of the server, set with the locale and timeZone attributes of webservices.
  4. The default of the Java runtime of the server, which follows the operating system or the container. The Chromium engine and Outside In Technology use the settings of their process environment instead (TZ, LANG).

An empty value counts as not set. The XRechnung visualization does not use the Java runtime: without a value it is German.

Without a configuration and without the attributes, nothing changes compared to previous behavior: the locale and the time zone of the Java runtime and of the process environment apply.

Effect per conversion path​

Conversion pathlocaletimeZone
Word ConverterYesYes: DATE and TIME fields
Templates for e-mails (eml, msg, winmail.dat), calendars (ics), contacts (vcf), text and SVG documents, and for headers and footersYes: language and format of dates and numbers; selection of the localized template if language of the template element is not setYes: the time zone in which times are shown, such as the sent date of an e-mail or the start of an event
Chromium engine (HTML, e-mail bodies, text, SVG, XRechnung)Yes: the locale seen by JavaScript in the page and the Accept-Language header of the requests of the pageYes: the time zone seen by JavaScript in the page and the date of a header or footer that uses the class date
XRechnung visualizationYes: English if the language of the locale is English, otherwise GermanNo
Outside In Technology (including xlsx and pptx)No: the process environment (LANG) appliesYes: only the standard offset of the time zone is used, see below
Office Bridge, SharePoint BridgeNoNo
Visual signature of the conversion (signature parameter node), see visible appearanceYes: the locale of the signature time, only with dateFormat set to localized; an own locale in identifierElements takes precedenceYes: the time zone in which the signature time is shown; an own timeZone in identifierElements takes precedence
Date of a header or footer of the Toolbox web service (not a conversion path), see headers and footersNo: the date format is numericYes: the time zone in which the current date is determined; a date that the request sets is used as given

The following applies in addition to the table:

  • Templates: an event of a calendar document that has a time zone of its own is also shown in that time zone, for example 03:00 PM CEST (09:00 AM EDT). All-day events and times without a time zone are shown as stated in the document. See templates.
  • Chromium engine: navigator.language keeps the language of the process environment of Chromium. JavaScript in frames that are loaded from another website does not see the locale or the time zone. The date of a header or footer that uses the class date follows only the time zone; its language is the one of the process environment. Without a value, the settings of the process environment apply unchanged. If Chromium rejects a value, the conversion ends with the error CONVERTER_CHROMIUM_PROCESS_ERROR (-160); there is no silent fallback to another time zone.
  • XRechnung: the language is English if the language of the locale is English, otherwise German. Only the layout supplied with webPDF is affected; a visualization or a stylesheet that you pass is not.
  • Outside In Technology: Outside In knows no daylight saving time. If a time zone is set, its standard offset, rounded to a quarter of an hour, is used for all dates, in summer as well; the offset is shown with the date, so the point in time stays correct. Without a value, the time zone of the operating system applies (on Linux the environment setting TZ of the server process), and here too only its standard offset.
note

The attributes change neither the dates stored in a document nor the time stamps of the PDF (creation and modification date, metadata, signature time). The document language of the PDF can be set afterwards with the language attribute of the Toolbox operation options, see document language.

Errors​

A value that does not have the form described above is rejected when the request is checked, with the error PARAMETER_VALIDATION_ERROR (-21). A value of the correct form that the Java runtime of the server does not know is rejected with PARAMETER_VALUE_ERROR (-20). There is no silent fallback to another value. See the error codes.

Defaults of the server and of the web services​

Four levels can set a default for requests that do not send the attribute. All of them are empty by default, which means the Java runtime of the server. In webPDF 10 they are attributes in application.xml; there are no separate environment setting names for them.

LevelElement in application.xmlAttributes
Server (all web services that evaluate a locale)webserviceslocale, timeZone
Converter web servicewebservices/converterlocale, timeZone
URLConverter web servicewebservices/urlconverterlocale, timeZone
Signature web servicewebservices/signaturelocale, timeZone
Toolbox web servicewebservices/toolboxtimeZone

The Toolbox web service has a timeZone only, because the date format of a header or footer is numeric. The value has the same form as the request attribute. A web service uses its own default first and falls back to the default of the server.

To take a value from the environment of the server, use a placeholder ${VARIABLE:-default} in the attribute. When the file is loaded, webPDF replaces it with the value of the environment variable VARIABLE, or with default if the variable is not set. With an empty default, the attribute stays empty:

<webservices locale="${WEBPDF_LOCALE:-}" timeZone="${WEBPDF_TIME_ZONE:-}">
...
</webservices>

The names WEBPDF_LOCALE and WEBPDF_TIME_ZONE are only examples; choose any name. The values are read when the server starts; a change takes effect after a restart.

An invalid value is handled in two steps:

  • Wrong form: the configuration cannot be loaded and the server does not start.
  • Correct form, but unknown to the Java runtime: if the value is the default of the server, the web services that evaluate it (Converter, URLConverter and Signature, and for the time zone also Toolbox) do not start; the other web services run. If it is the default of one of these web services, only that web service does not start. The server log names the attribute and the value.

The configuration check locale of the administration API validates all of these defaults before they are saved.

In a cluster, the coordinator distributes the configuration, but each node checks the values against its own Java runtime. Nodes with different Java versions can therefore differ in whether they accept a value.

Conversion reports​

With the fontIsMissing, fontAliasUsage and contentProblems options of the report parameter, a conversion ends with an error when it finds a font problem or content it cannot reproduce faithfully: CONVERTER_FONT_ALIAS_USED (-107), CONVERTER_FONT_IS_MISSING (-108) or CONVERTER_CONTENT_PROBLEMS (-109). All three options are off by default. See the error codes and font decisions for what each code means.

Report message​

For the native Word Converter, the message of such an error lists the entries of the report, one per line in the form LEVEL (CATEGORY) - text. The message carries at most 100 entries. If there are more, the last line reads … and N further problems, where N is the number of entries left out. Where entries are left out, those of the problem category that selected the error code come first. The complete report is written to the server log at level DEBUG.

note

The text of the message is for information only. Only the error code is machine-readable, and the order of the lines is not defined.

You can change the limit with the following environment setting. It has no equivalent in server.xml, and it is read once when the first report message is built, so restart the server after you change it.

Environment settingSystem propertyDefaultDescription
WEBPDF_CONVERTER_REPORT_MAX_ENTRIESwebpdf.converter.report.max.entries100Maximum number of report entries in one report message. A value that is not a positive number is ignored, and the default is used.

E-mail attachments​

When an e-mail is converted with the attachmentMode convert or convertMerge (see HTML conversion), every attachment is converted with the same parameters, including the report options.

  • If a converted attachment ends with -107, -108 or -109, the e-mail ends with that error. If several attachments report, the highest ranking code applies: -109 before -108 before -107. No document is returned, as with a direct conversion that ends with such an error.
  • The message names every reporting attachment in a line Attachment '<name>' (<code>): <message of the code>, followed by its report entries. The limit above applies to the entries of all attachments together; the lines naming the attachments do not count against it.
  • Any other error of an attachment does not fail the e-mail: the attachment stays embedded in its original format, and the e-mail is converted successfully.
caution

Previously, a report error of an attachment was not passed on, and the e-mail was returned as a successful conversion. An integration that sets a report option and converts attachments now receives the error.