iText is a Java API for reading, writing, and editing PDF documents and PDF forms. A recent release adds support for AES encryption of documents, as well as better integration with Acrobat forms.
Adobe's Portable Document Format, or PDF, has long been the standard for online document sharing where high fidelity print output is a requirement. The iText project's PDF library is perhaps the best-known open-source API to create, read, and edit PDF documents from Java.
iText supports a rich set of PDF capabilities, such as the ability to select fonts, specify hyphenation, generate PDF in various page sizes, include tables and graphics in PDF documents, print page numbers, headers, and footers, use watermarks, and even supports the creation and reading of barcodes and document encryption.
In addition, the iText API works well with other report-oriented Java projects, such as JFree, allowing easy insertion of JFree reports or JFree charts in PDF documents. Another notable feature of iText is its support of PDF-based forms, or AcroForms. iText is dual-licensed under the Mozilla Public License and LPGL.
The latest iText release adds the ability to encrypt a document using AES, the standard document encryption format used, among others, by the U.S. government. Better integration with PDF forms is part of the new release, as are bug fixes.
If your projects call for high-quality print output, how do you generate such documents, especially in a Web application? If you've used iText for that purpose, what is your experience with it?
It's good, but too low level for my taste. I would prefer a smoothly working FOP, which unfortunately is not working very smoothly at the moment (but it does work though).
In other words iText is nice, but not easy to maintain because you end up with some if the text of your document sprinkled throughout your Java class.
You can take iText and develop a templating system yourself, but then why not use FOP?
My feeling is, based on some small amount of experience, iText does what it advertises to do, which is great. What else can you hope for? On the other hand, I am not a huge fan of what it advertises as it is too low level of an API for my personal taste.
It's kind of like having a great assembler when you want to use C, or like having a great C compiler when you would really prefer Scheme.
We have been using iText for a while in our web applications for generating reports in tabular format. Very often we are challenged with the requirements of generating Advanced Search screen (where the users select which columns must be displayed and which criteria must refine the search) with output as Html, Excel and PDF.
iText proved to be very flexible: we build the search engine independently (jdbc or Hibernate), then implement a layer which generates the output (just using iText html-alike language). The different formats (excel, pdf, html **) are simply generated changing the header of the response:
For reports which are more sophisticated (master details, sub-reports, graphic elements) we prefer Jasper, but for reports in tabular format which require multiple outputs iText is surely an excellent option.
(**) for html we still prefer using a different approach (JSP taglib) because we need to provide features like page browsing, sorting by column header, links and more readable look-and-feel.