J J
J J

Reputation: 146

Having Freemarker-like templates for PDF generation (with itext)

In Java Project, i would like to use a Freemarker or something similar to it (Quick start guide), but to generate a PDF file (textual), with IText for example.

Of cource, the workflow could be like that:

Template (Freemarker) -> Text (IText) -> PDF

...but I feel it is kind of a naive approach. I want to have in the PDF some formattings, tables, etc.

Anyone knows how to design it properly?

Upvotes: 0

Views: 4504

Answers (1)

Joop Eggen
Joop Eggen

Reputation: 109593

As PDF is a binary format, the best seems to generate some standard text format for which there exists a PDF conversion.

Texts --[FreeMarker]--> HTML or      --[HTML-to-iText]--> PDF
                        DocBook XML

This also allows validation of the FreeMarker templates.

Upvotes: 1

Related Questions