I have to generate a PDF document/report from the database tables. The
content has a tree-like structure. There's a master resultset, e.g.
Organizations, with several fields. This may contain nested sub-resultsets
for every Organization, e.g. Departments, Affiliates, etc. These
sub-resultsets also may have nested resultsets, and so on. The tree is not
very deep (3-4 layers).

So, the resulting PDF has sections for every Organization, inside it has
subsections for Departments, Affiliates and so on. Like chapters and
sections of a book.

When section doesn't fit the page, on the next page's header there must be a
section name repeated. So, if Affiliate breaks on the page end, then on the
next page header there'll be: "Organization name", "Affiliate name", i.e.
its each parent sections' names too.

I found one way to do it with XSL-FO:
there's a main fo-table(TM) with one column.
Every row's the only cell contains a fo-table(T1), with header
"Oraganization name". This T1 table's rows contain three blocks, one block
is for Organization's fields, the other two blocks are for Departments and
Affiliates, which are also fo-tables. This way whenever the section is
broken into pages, the fo-tables' headers will appear on the next page for
every broken section. E.g. when T1 breakes on page end, TM's and T1's
headers will by rendered on the next page.

This works fine rendering what I want. The issue is with performance. XSL-FO
generation takes 3 seconds. PDF generation takes more than 15 seconds. So,
FOP part is a bottleneck. I strongly suspect that these many embedded tables
and blocks are causing troubles to FOP. I may be wrong though.

I see two options: one is to change FOP to something else (renderex?), the
other one is to change the structure of XSL-FO document.

I'm going to work on the problem these days, since it appears that
performance is going to be the main concern for customers. So, I'll
appreciate any advises very much.


Reply via email to