File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Other Open Source Projects and the fly likes Apache FOP and iText Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Other Open Source Projects
Bookmark "Apache FOP and iText" Watch "Apache FOP and iText" New topic
Author

Apache FOP and iText

M Turner
Greenhorn

Joined: Dec 16, 2009
Posts: 25
I have a requirement to present a PDF on demand in a web application injecting user specific data. I'm looking at both Apache FOP and iText for the solution.

It seems to me that iText is a better fit for what we're doing. However, it would be ideal if we could separate the styling of the PDF from the code that generates the document. I don't see evidence of being able to separate the style from the document generation code in the simple iText examples that I've seen. Although I gather that this is the way it's done in Apache FOP.

Should I be considering using both rather than one or the other? From the iText mailing lists it does seem to me that people use both libraries together. Can I generate a document with all the data in iText and then apply the styles using FOP? It seems like FOP wants an XML document to work on.

How have people solved this problem? Both libraries have been around for a while so I assume people have, but I don't see much comment on this fact online.

TIA

Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42935
    
  68
Your perception is correct that using iText your style information would be part of the Java code (obviously, you could factor style info out into properties that get consulted when the PDF is created, but basically the Java code is where that information is specified).

FOP and iText are often mentioned together because FOP uses iText underneath; but that's completely transparent to FOP users.

FOP makes sense if your data is highly regular (lots of tables), or if you have XML data to begin with. Plus, maintaining XSL-FO stylesheets is a skill one needs to acquire, while iText's API approach should be familiar to every Java developer.
M Turner
Greenhorn

Joined: Dec 16, 2009
Posts: 25
Thanks very much for sharing your insight into this matter!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Apache FOP and iText