views:

268

answers:

5

I've been looking at various pdf generating libraries for use a Java based application. The primary requirement is produce letters and insurance documentation. Ideally the design of the documents should be quite easy to change, with out a new release of the code.

So far I've looked at:

  1. Jasperreports - solid library used it before, not sure it's quite the right solution for letter printing and other text heavy output with page text reflows etc
  2. Big faceless - commercial and quite expensive, but offers quite a compelling feature set
  3. iText - Pretty sure that just about anything is possible, but would seem to require code changes for even the most simple document change
  4. apache FOP - lots of XSL

I'm I missing any libraries/tools?

EDIT:

  1. flying saucer - has anybody used this for this style of problem
+2  A: 

I think you pretty much mentioned three of the big ones I am familiar with ( I am not familiar with Big faceless). I don't have any new ones to add to your list, however, I thought I would give my experience with the ones you have mentioned.

One of my contracts uses FOP/XML/XSL. We basically use the XSL as the template and form XML using SQL stored in database matrix tables. So when the user selects to create a document type we query the DB, create the XML from the result set then generate the PDF from the XSL. The only time we have code changes deployed is when there are changes to the generation of the PDF. We also use a replacement text piece that allows for users to specify specific data that would not otherwise be stored in the DB and put into the XML for generation. When there are problems or changes with this part it always requires a code deployment.

Most of our changes require either XSL or Database (data only) changes so no need for code deployment (most of the time).

As a side note, we also store the XML in a CLOB so we can access it when we want to regenerate the PDF through a web service or any other process. The stored XML also allows for an added layer of debugging.

Another contract I have uses iText (but for C#). It is sweet but it does require a lot of maintenance and code changes/deployment. However, there is no requirement that I have been given that could not be solved with iText...at least yet.

northpole
thanks for your answer, I like the idea of storing just the FOP xml instead of the pdf binary for long term storage
Gareth Davis
Absolutely store the FOP, PDFs get especially big if you embed fonts/images into them.
Mike Cornell
+1  A: 

Just to throw this out there for completeness sake.

The commercial solution, Adobe LifeCycle, does the type of thing you're looking for.

Mike Cornell
you'd think these guys would know a thing or two about pdfs. Thanks for the pointer, will look into it
Gareth Davis
The main problem is, it's not cheap. It doesn't sound like the solution for your problem, per se. But others might think it's useful.
Mike Cornell
+1  A: 

iText allows the creation of PDF documents via XML. The SAXiTextHandler class makes this possible. You can subclass this class to change how the XML is translated to PDF.

Your problem is now (somewhat) simplified to generating an XML that SAXiTextHandler can process to generate the PDF.

Francois Gravel
interesting, thank you
Gareth Davis
A: 

If you are looking for a document generation system on Java, take a look at this Java document generation site. It has basic info on all the vendors. It makes for a great starting point

+1  A: 

There is also BIRT (Business Intelligence Reporting Tool) here which I found to work well although it does introduce some bloat into a web application. If you want a nice WYSIWYG report design tool integrated into Eclipse (or standalone) for business users to work with then it'll do the trick.

Gary Rowe
Trick is how suitable is it for letter and policy documentation for an insurance system?
Gareth Davis
It's pretty comprehensive in it's approach. It provides the usual suspects: RTF labels, tables, images, data field insertions and aggregates calculations. In addition, it provides a fully Java and JavaScript enabled scripting approach to allow completely arbitrary operations to be carried out. It's not limited to PDFs, it'll produce Word, Excel, PostScript, HTML, Scripted HTML and so on. Quite powerful overall.
Gary Rowe