iText is an open source document generation framework. I've been working with it for a couple months, and gave a technotizer talk on it at last night's AustinJUG. I thought I'd summarize my points here.
iText is a document generation framework. It generates a number of document types, but the primary use of it is for generating PDF documents. PDF is a very interesting format for content generation. PDF has the capability to render high-quality documents that render very precisely in any PDF viewer. They even print well. PDF documents are really great for offline content, and you can even do interesting document workflow with PDF forms and signatures. PDF is not a replacement for HTML in general, but there are many cases where PDF is a more interesting format than HTML. It's almost more interesting than heavier proprietary formats like Word documents. Although Word is assumed to be nearly everywhere, even Word isn't as ubiquitous across platforms as PDF is.
PDF doesn't support any of the structural or semantic constructs found in HTML. It's truly a blank slate that you can put content into. iText adds higher level constructs like paragraphs with text flow, images, tables, nested lists. To add a table structure, you create a table object, add the content cells and then add it to the document.
In that sense, the programming model looks somewhat like DOM. However, with iText you aren't really building up a model of your document. While you have model objects for individual elements, once you add them to the document they are processed in a very SAX-like way. Events are generated and sent to the document listener (the object responsible for rendering the document) and then they are thrown away. Once you add content to the document, you have effectively committed them to the document. It's a bit awkward, but the result is an API that is very efficient and does not use any more memory than it actually needs.
iText also supports the manipulation of PDF documents, but you lose any concept of the higher-level constructs like lists or tables. The typical use case seems to be pulling in an external document and adding content on top of it - adding a logo, a watermark or filling to a template document.
I've been working with iText for a few months to add PDF generation in Seam 1.1.1. I like the approach as a good mix between traditional XML/XSL -> FO -> PDF chain and the pure Java approach of iText. You get positive benefits of working in a concise, declarative format without being tied down to a very static infrastructure. With Seam PDF, the template actually generates a dynamic JSF UI model, one that you can extend with your own components and that can trivial interact with conversation/session state, business process data or even your business rules.
Should you use iText? On the negative side, I'd say that the output from iText doesn't look as beautiful as the PDF you might see from a design tool. That might just be my lack of experience, but the documentation doesn't provide good examples of truly high quality output. I'd label it "medium quality". If you need very high quality output, I think you are best designing a template in design tool and just using iText to overlay your dynamic data. The end result should be quite professional. The other negative is that the API is ... unpolished. There are many places where I banged my head against the inconsistencies throughout the system.
However, on the plus side, iText works, and it works very, very well. I didn't encounter any serious issues with the code. It is fast and has a small memory footprint. The PDF had no issues in any of the PDF readers I used. I even loaded a few of my documents onto my Sony eBook reader. (As a side note, iText can easily generate content in the optimal dimensions for the smaller screen. I did some experiments rendering RSS feeds to PDF for offline viewing and was quite impressed with the results) iText is also an active open source project. I think it has a long life ahead of it, so integrating iText into a project shouldn't be considered a big risk.
All in all, when you have a need for PDF generation, I do recommend giving iText a look. When you do, you should also check out iText in Action. I found it very helpful in learning iText, though I do wish there were more s examples.