Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Document template engine

I need to choose a good template engine to generate documents in our application. The requirements are:

  • Generate Microsoft Word and PDF at least
  • Good templating capabilities including support for simple replacable parameters, arrays/lists, and hierarchies if possible
  • Allow to include custom graphics
  • Ideally templates should be editable with Microsoft applications or other user-friendly equivalent

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.

like image 857
Michael Pliskin Avatar asked May 22 '09 16:05

Michael Pliskin


People also ask

What is template engine used for?

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.

What is Python template engine?

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.

What is HTML template engine?

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.


1 Answers

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.

like image 112
JasonPlutext Avatar answered Sep 19 '22 11:09

JasonPlutext