Skip to main content
Version: 10.0

Templates

webPDF uses templates to convert various file formats to PDF format. These templates can be found in the templates/ server installation folder and have .ftl as their extension. The templates are text-based and can be opened with a normal text editor.

As of this writing, the following are the file formats for which templates are used for conversion with the Converter web service:

File extensionFile formatTemplate file
emlMIME mailmail.ftl
msgOutlook mailmail.ftl
icsiCalendar/vCalendarics.ftl
vcfvCardvcf.ftl
svgSerial Vector Formatsvg.ftl
txtText documenttext.ftl

The templates are HTML-based and contain variables and a macro language. For more information, please refer to "Template format".

Template language​

The mail.ftl, ics.ftl, and vcf.ftl templates are available in German and English (the German templates will have _de as a filename suffix, e.g., mail_de.ftl). To select the language you want, use the language parameter of the template element in the parameters for the Converter web service. Enter the ISO 639-1 code for the language you require, or system. It selects the localized template and the language in which the template formats dates and numbers.

If language is not set, or set to system, the language of the locale of the conversion is used: the locale of the request, otherwise the default of the web service or of the server. Without any of these, the language of the Java runtime of the server applies, as before.

You can also translate the templates for your own language and store these new versions in the templates/ folder. If, for instance, you wanted to have a French translation for e-mails, you would save the mail_fr.ftl file in the folder and set fr as a value for the language parameter.

caution

Changes you make to the templates/ folder may be overwritten during an update, so make sure to always back up your templates before an update.

tip

It is recommended not to save custom and modified templates in the templates/ folder, but to instead pass them directly with template when calling the Converter web service.

Locale and time zone of the templates​

The locale and the time zone of a conversion apply to all templates of a Converter or URLConverter request: e-mails (eml, msg, winmail.dat), calendars, contacts, text and SVG documents, and the templates of headers and footers. They are set per request with the locale and timeZone attributes, or by the defaults of the web service and of the server; see locale and time zone for the order of precedence. Concurrent requests with different values do not influence each other. Without a value, the locale and the time zone of the Java runtime of the server apply, as before.

  • Time zone: times are shown in the time zone of the conversion, for example the sent date of an e-mail, together with an indication of the time zone.
  • Calendar events: an event that has a time zone of its own is shown in the time zone of the conversion and, if the two differ, additionally in the time zone of the event, for example 03:00 PM CEST (09:00 AM EDT) (the German template shows 15:00 MESZ (09:00 EDT)). All-day events are shown without a time, and times without a time zone (floating times) are shown as stated in the document, without conversion and without a time zone indication. The anniversary of a contact is shown on the day stated in the document.
  • Custom templates: the time zone applies to a custom template as well. As a custom template replaces the templates of the templates/ folder, its language is ignored.
note

The time zone does not change the dates stored in the document or the time stamps of the PDF.

Custom templates​

You can use your own custom templates for conversion. In fact, you can pass a custom template as a BASE64-encoded text with template in the parameters for the Converter web service.

{
`Converter`: {
"template": {
"data": {
"source": "value",
"uri": "",
"value": ""
},
"file": {
"name": "",
"source": "value",
"uri": "",
"value": ""
},
"language": ""
}
}
}

To this end, you can take the existing templates and modify them as required for your needs, or you can create entirely separate custom templates. For more information on how to define and modify templates, please refer to "Template format".

caution

If you pass a custom template, no templates will be loaded from the templates/ folder, and the language specified in the parameters will be ignored as well.