I need to choose a good template engine to generate documents in our application. The requirements are:
The task is to feed some data structure from the system and make a nice document from it. Examples include reports, business proposals, product visions and more. Ideas are welcome :)
One approach is to write one myself but maybe there is something out-of-the-box and not necessarily free. Technically best if it could be cross-platform but Windows-only is fine as well as a last resort.
A template engine enables you to use static template files in your application. At runtime, the template engine replaces variables in a template file with actual values, and transforms the template into an HTML file sent to the client. This approach makes it easier to design an HTML page.
Template engines take in tokenized strings and produce rendered strings with values in place of the tokens as output. Templates are typically used as an intermediate format written by developers to programmatically produce one or more desired output formats, commonly HTML, XML or PDF.
Template Engines are tools that help us break HTML code into smaller pieces that we can reuse across multiple HTML files. They also give you the power to feed data into variables that help you simplify your code. You can only use template engines if you had a way to compile them into HTML.
People are using docx4j to do that sort of thing. (Disclaimer: that's my project)
docx4j gives you the tools to create docx documents (as opposed to the old binary ones), and output to PDF (though ymmv).
For commercial document generation, look at the likes of Exari and Thunderhead.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With