Rolf
Rolf

Reputation: 2388

Rendering blocks side-by-side with FOP

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.

Upvotes: 4

Views: 3268

Answers (1)

Rolf
Rolf

Reputation: 2388

So, as usual when I post a question I find the answer a few minutes later. See table-based solutions in this stackoverflow-thread.

Perhaps formulating your problem into a post works as a kind of mental aid, and takes you a bit closer to solving the problem even before you get a single answer. Oh well. All's well that ends well.

Upvotes: 5

Related Questions