Rendering blocks side-by-side with FOP

Posted by Rolf on Stack Overflow See other posts from Stack Overflow or by Rolf
Published on 2012-01-24T19:06:05Z Indexed on 2012/06/28 15:16 UTC
Read the original article Hit count: 248

Filed under:
|
|
|
|

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:

enter image description here

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.

© Stack Overflow or respective owner

Related posts about table

Related posts about layout