There were questions on that but not recently and technology must have gone ahead since then.
Requirements:
- generating pdf documents based on predefined template (I can use either pdf forms or xsl-fo)
- being able to fill textual data
- being able to fill graphical data (generated bar codes)
- being able to alter pdf template in production environment without patching (recompiling)
- generating pdf file to be saved in the database (as blob) and/or printed
- open source/free
The options assumed are iText, PDFBox, FOP, anything else? What are recommendations based on the requirements above?
- iText; nowadays iText is a commercial library, the latest version is not for free anymore
- FOP; I worked a lot with FOP. It's fairly resource intensive (Java > XML > XSLT > PDF) and complex PDFs become a nightmare ( may result in XSLTs with 20k+ LoC)
- PDFBox; it seems to be the best alternative although I did not work with it in large projects
- Did not check Flying Saucer yet
To conclude, I'd give PDFBox a try. Depending on your bar code requirements you may need to inline your barcode (font) into the PDF or distribute the font to your clients - take care of those issues.
I've done a project with Flying Saucer http://code.google.com/p/flying-saucer/ which is based on iText. It's free, easy to use, has great support for CSS, and has nice open source.
I think your criteria can be met with both iText and Apahce FOp but here you have some additional criteria:
- licensing: FOP is based on Apache license and therefore "friendly" also for commercial use
- flexbility: a low level API like iText is more flexible than high level FOP
- Visual tools: there is one designer for FOP here.
- Programing Model: iText is based on programming API while FOP requires a XSLFO template and less programming.
- Proprietary vs standard. Apache FOP is based on a standard and therefore vendor independent, while iText is a proprietaRy API
- Performace: It is said FOP is more computing intensive. it depends of course of what your target PDF files are. It was a never issue for me using FOP.
I would not use PDFBox, it is good for reading and modifying an existing PDF file but createing a file from scratch using PDFBox can be a lot of work.
I'm a bit biased (committer), but I suggest iText.
generating pdf documents based on predefined template (I can use either pdf forms or xsl-fo)
PDF forms: Check
being able to fill textual data
PDF Forms, check. You can also perform programmatic layout.
being able to fill graphical data (generated bar codes)
Check. Given a known location (which could be "the location of this particular annotation"), iText will draw a barcode for you given a symbology and value. You can deduce a list of supported symbologies from the constants listed here.
For this sort of thing, I use Button fields with an "Icon Only" appearance. The "icon" is some arbitrary PDF drawing instructions, or an image. iText's barcode stuff will create a PdfTemplate
you can stuff into the button without too much trouble.
being able to alter pdf template in production environment without patching (recompiling)
If all your layout is baked into the PDF template, and your "barcode goes here" info isn't hard coded into the source, then you're golden.
generating pdf file to be saved in the database (as blob) and/or printed
A PDF is a PDF is a PDF. Heck, with some extra work on your part, you can use iText to build PDF/A files. "A" is for Archive.
open source/free
Open Source: Yes. v2.1.7 was the last version to use the MPL. Since 5.x, all iText releases have been under the AGPL. Yes, iText skipped from 2.1.7 to 5.0, in order to synchronize the version numbering between iText and iTextSharp.
Not exactly "little f" free, but the 2.1.7 version isn't that hard to come by. OTOH, it's orphan-ware, unmaintained. Be an informed consumer.
It depends how exactly you want to create the PDF as well. FOP works from XML, IText lets you create programmatically from Java.
Another thumbs up for flying-saucer. It works quite well and is easy to use if you're familiar with html and css.
What isn't really documented is how to access iTexts built-in barcode functionality. However this can be easily accomplished. I've put up a short tutorial here: http://andreas.haufler.info/2012/12/generating-barcodes-in-pdfs-with-flying.html
nobody is talking about BFO(Big faceless) though it's commercial