Using iText for PDF generation

Over the last year or so I’ve done a lot of arseing around with FOP PDF generation. It’s really very powerful, but with great power comes great fannying around with complex XSLT (that’s what Peter Parker’s uncle said wasn’t it?). If you’re doing serious PDF work with multiple templates or complicated logic built into the documents then FOP’s your guy. But I’m doing some more simple documents at the moment for which FOP seems like the proverbial sledgehammer, so I decided to take a look at iText. This is an open source Java library which allows you to create PDF documents in double quick time. It’s actually pretty powerful in it’s own right with support for watermarks, PDF joining, complex table structures etc. I’m just not sure you’d want to go this route for serious reports where you’ll effectively be tieing UI design into code. That’s your call in the end anyway. I’m just here to tell you that this stuff works out of the box with Notes and Domino.

Vince Di Mascio has done the heavy lifting here with a sample Java agent which will generate a simple PDF document. Check it out if you need to produce any sort of documents from your app.

Share