|
|
AS OF 7/20/2008 5:39PM EST
|
January 15, 2007 —
Many software packages today have some kind of bundled reporting option. Many of these packages use either a home-brewed solution or they depend on the seemingly ubiquitous Crystal Reports engine. Increasingly, though, users expect that a PDF report can be generated, rather than the usual HTML display or Microsoft Word or Excel-based document.
In the past, these PDF-oriented users would fend for themselves by getting software that would create a virtual printer on their system. Documents printed to this device would be rendered as PDF files that the user was then free to save as needed. Adobes Acrobat package provides one such solution. Another good option is pdfFactory from FinePrint (www.fineprint.com). There are also some freeware products that offer similar functionality. However, not having tried them, I cannot vouch for them.
But this approach is hardly right for the majority of users, who are unlikely to install a printer driver just because you couldnt figure out how to provide them with reports in PDF. Fortunately, you have options.
There are several commercial packages, such as the ActivePDF (www.activePDF.com) line of products that do document conversion or generation of PDFs. In their standard configuration, they reside on a server and handle documents either from client systems or generated on the server itself. These products tend to be especially strong in handling PDF-based forms, which are filled in incrementally as various stages of a transaction are executed.
The most flexible solution for PDF creation I have encountered, however, is a free, open-source library called iText (www.lowagie.com/iText). This is a Java library with an extensive API set for controlling all facets of document generation. iText handles even tricky elements with aplomb: multiple columns, embedded images, justification, multiple fonts, including fonts that read from right to left, and so on are all provided for with straightforward API calls.
The most common use of iText is on a Java server, from where it spits out PDFs to the servlet engine, which then delivers it to the user. Frequently, you will code the document using the basic APIs, leaving certain areas blank. Then as you run the report, you fill these areas with data and write them out to the document using iText calls. The library can also output HTML and Microsoft RTF files.
While the iText Web site has remarkably good documentation on it, the best place to get the information you needespecially in the case of using iText in conjunction with JSPs and Web frameworksis in a newly released book, iText In Action from Manning Publications, a publisher of consistently high-quality niche books. This volume is no exception, and it makes a topic that will surely be foreign to many users entirely approachable.
iText is remarkable for its comprehensive feature set. Just about anything you can do in PDF (watermarks, signatures, security, metadata, tagging and so forth) can be done in iText. What surprised me is that iText is unique: To my knowledge, there is no other freeware package with its capabilities, or even a large subset of them. Uniqueness in open source, where almost all projects have several direct, competing counterparts, is comparatively rare. Perhaps due to this, the iText team is just completing a port to the .NET platform. (See itextsharp.sourceforge.net.) It is written in C# and runs on .NET 1.1 or later. The lead on the iText project, Bruno Lowagie, at the University of Ghent, in Belgium, hints that other ports are likely in the future.
My own exposure to iText has come in the context of an open-source project I work with, called Platypus (platypus.pz.org), which is devising a document specification language in the spirit of TeX. The funny name is a loose acronym for Page LAyout and TYPesetting for USers. The for users is a key point: It seeks to be far easier to use than TeX or LaTeX. It also will have special capabilities for program code (such as intelligent line breaks for code and the ability to embed numerical symbols for reference in subsequent text). A reporting engine is an additional feature.
The project, in Java, was restarted when iText was discovered. Previously, Platypus was written in C and focused on providing the low-level functionality that iText delivers comprehensively. And so, from this experience, I am intimately aware of how easy iText makes PDF document creation and can recommend it as an excellent solution for your next report project.
Andrew Binstock is the principal analyst at Pacific Data Works. Read his blog at binstock.blogspot.com.


|