FOP memory goes Flop

Have any of you used F.O.P. before? I gotta tell you, it’s a fantastic tool for handling XSL-FO. The only problem is… umm… I forget… err… oh yeah, memory. I’ve been struggling far too long with the pigginess of F.O.P.’s memory requirements and now it’s starting to get to me. (Everything is starting to get to me lately because it’s just been one of those kinda months!) I’ve done all sorts of dancing around in XSLT to please the memory requirements of FOP and it’s just not worth while. When you produce FO grammar that nests a whole bunch of page data in one page-sequence element all of your heap memory packs its bags and proudly exclaims, “See ya! I’m off to FOP land!” So what I had to do was become the Sesame Street Count and figure out how many angle-bracketed things expand to text-like stuff to fit on each page.

The count“One, two, uh three! Ha…ha…haaaa! [lightning strikes loudly] Three <fo/> blocks under our current flow elements!!! I’ll keep counting! Four! Five! Six!!! [more lightning] Ha…ha…haaaa!!!! …”

It’s lots of fun and my two year old loves me for it but boy does it take time! What I would like to know is if there are any other open source Java FO APIs available. (I realize that’s a little like asking if there are any other purple flamingos named Camille living on the northen side of the Atlantic Ocean but cut me some slack. I’m frustrated!) Are there any better ways to produce PDF output from XML that don’t require tearing apart my brittle and already heavily-tied-to-FO-and-TrAX logic? (I have about 35-40 individual classes, and 50+ XSLT stylesheets that are constantly expecting their first cousin FO-TrAX over for dinner. It’s a combined total of roughly 40-50 KLOCS (KLocs are thousands of lines of code) of micro-managed brittle application design authored in part by yours truly.) Do I have any other options? I’m only trying to fix a bug, which to my boss equates to a few hours worth of development. In all reality it’s a cosmetic thing that would appear to be a two minute fix to most people but the code is so fragile that of course there’s extra work involved. Why can’t I just generate FO without counting lines? Why can’t I drop in another engine and be done with the whole mess? (Incidentally, I tried the both FOP trunk and trial version of RenderX a little over a year ago and still suffered OutOfMemory errors with large page-sequences.) Is there an overall flaw in the entire FO spec? If so, does George Bush know about it? Somebody really ought to inform him. Holla if you know better…

One thought on “FOP memory goes Flop

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s