velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter_F...@blm.gov
Subject Re: Can velocity be used for generating reports in PDF
Date Thu, 16 Oct 2008 20:41:48 GMT
The way I did this was to have my Velocity templates generate output text
that was sent to a PDFWriter class that I wrote. This class detected
special markers in the input stream that indicated new paragraphs,
bold/underline/italic sections, font changes, images etc., and made calls
to iText to create the "chunks" that iText uses and add them to the PDF
output document on the fly. It could handle basic stuff (paragraph styles,
multiple fonts, tables, background colours and images, embedded images) and
was adequate for what I needed it for. It couldn't handle more advanced
stuff like floating sidebars, but that wasn't something I needed.

That was a while ago. If I was going to do the same thing again I'd have
the Velocity templates produce XML and base the Writer on Commons-Digester.

It's always possible that there is a direct PDF Writer class out there
already that accepts input text in some handy form like XML - I just did a
quick Google and didn't find anything, but it's such an obvious thing I'd
be surprised if there isn't *something*.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
For additional commands, e-mail: user-help@velocity.apache.org


Mime
View raw message