Templates
webPDF uses templates in order 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 extension | File format | Template file |
---|---|---|
eml | MIME mail | mail.ftl |
msg | Outlook mail | mail.ftl |
ics | iCalendar/vCalendar | ics.ftl |
vcf | vCard | vcf.ftl |
svg | Serial Vector Format | svg.ftl |
txt | Text document | text.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, you will need to use the "language" parameter in the parameters for the "Converter" web service. Simply enter the ISO 639-1 code for the language you want.
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.
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.
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.
Custom templates
You can use your own custom templates for conversion purposes. In fact, you can pass a custom template as a BASE64-encoded text with template
in the parameters for the "Converter" web service.
API {REST}:/converter
{
...
"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".
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.