Rendering blocks side-by-side with FOP
- by Rolf
I need to generate a PDF from XML data using Apache FOP. The problem is that FOP doesn't support fo:float, and I really need to have items (boxes of rendered data) side-by-side in the PDF. More precisely, I need them in a 4x4 grid on each page, like so:
In HTML, I would simply render these as left-floated divs with appropriate widths and heights.
My data looks something like this:
<item id="1">
<a>foo</a>
<b>bar</b>
<c>baz</c>
</item>
<item id="2">...</item>
...
<item id="n">...</item>
I considered using a two-column region-body, but then the order of items would be 1, 3, 2, 4 (reading from left to right) since they would be rendered tb-lr instead of lr-tb, and I need them to be in the correct order (id in above xml).
I suppose I could try using a table, but I'm not quite sure how to group the items into table rows.
So, some kind of workaround for the lack of fo:float would be greatly appreciated.