Originally posted by Gregg Bolinger:
Have you used iText? If so, how does it compare with FOP? Or is it similar enough that there is a comparison. I find iText pretty easy. Do just looking for opinions.
I haven't used iText so I really can't offer a comparison. I will point out that FOP is just an xsl-fo processor programmed in Java, which can be used stand-alone but also has an API which you can use to call it from within your code. It takes an xsl-fo document and can ouput pdf or a few other outputs.
Is an fo based solution for you? If you want a non-proprietary solution, yes. Since xsl-fo is a w3c standard, any FO processor would be able to render an fo document, not just FOP. If you have a particular reason that using XML technologies would make sense for your project, then using something like FOP would be a good direction to head in.
Our requirements were to make a complex multi-page printer-friendly version requiring precise layout of some web-based material. The basic flow we used was to produce a DOM (using JDOM) of a heirarchy of Java objects. Once we had our DOM, we transformed it using an xsl stylesheet to provide the proper xsl-fo markup, as well as a sprinkling of svg. We took the transformed DOM, and fed it to a
servlet (in this case acting as a view for a
Struts application) which rendered the pdf using FOP and produced an output stream of type application/pdf.
The upside for us was that we will be able to re-use portions of that, particularly marshalling the objects to xml, for other requirements we have coming down the road. Additionally it is a relatively simple thing to do to change the xsl stylesheet if we have any tweaks we need to make, and we have maintained separation of our data and presentation.