Skip to main content
Version: 9.0

Template format

webPDF uses the Apache FreeMarker template engine for templates. All templates are written in FreeMarker Template Language (FTL) and are essentially based on HTML and a macro language with variable replacement.

All templates are found in the "templates/" folder and have ".ftl" as their extension. Moreover, the files are text-based and built with HTML. The templates are used to convert specific file formats.

The entire FreeMarker macro engine is available for the templates.

tip

For more information on the FreeMarker template engine, please visit https://freemarker.apache.org/docs/index.html

When converting documents, the templates are loaded, the existing variables are replaced with the corresponding document contents, and the entire document is converted as an HTML document to PDF format using the Chromium bridge.

There can be various variables, all starting with a prefix, available in the documents, with the specific variables depending on the specific template.

TemplateFile formatVariable prefix
mail.ftlMIME/Outlook mail${mail. ...}
ics.ftliCalendar/vCalendar${ics. ...}
vcf.ftlvCard${vcf. ...}
svg.ftlSerial Vector Format${svg. ...}
text.ftlText document${text. ...}

You can take the templates as a basis, modify them, and then pass the modified templates when calling the "Converter" web service. This way, you can customize the conversion of specific file formats according to your own specific needs.

You can create a completely new PDF document using HTML, the FreeMarker template language, and a definition of your own custom variables. Moreover, you can use all HTML and CSS functionalities in addition to the macro language and the variables. For more information, please refer to the "HTML as template" document