I am using fop with a two column layout and am having some problems with
the column balancing when there is a spanned block midway though a page.

My material contains a lot of tables with keep-together's and external
graphics. The image/table which are just too big to fit in the estimated
height of the first column are correctly move into the second column,
but this causes the second column to become longer then the estimated
maximum span height, this in turn causes fop to insert a page break and
move the end of the second column to the next page. However this looks
very odd as often 80% of the original page is still blank. Fop already
has a safety margin built into BodyAreaContainer.resetSpanArea() to
address this problem, however it is set to small for my content.

You can easily overcome this problem by increasing the safety margin
which is added to maxHeigh in resetSpanArea() (from 2 * 15600, to 2 *
45600 in my case). This has the added benefit that it causes the first
column be about 4cm longer then the second before each span, which adds
some much needed white space to my layout.

However this introduces a new problem (which must be present to a lesser
degree anyway), the safety margin added in resetSpanArea() is added
after the check to see if the span's content fits on the page, this
means that if the content already filled the page, the span's new height
is increased by the safety margin and overlaps with the footer.

As far as I can see there are two ways to work around this:

Disable the column balancing when the contence of a span overflows the
page - simple set the column heights to the avaible size and then fit as
much content into column one followed by column two. (This must be what
happens on the last page of a flow).

Change where the safety margin is added so that it is taken into account
when checking if the content fits on the page. This would cause some
unforinate white space at the bottom right of every page but I could
live with this. 

Whilst these sound fairly simple, my Java experience is limited and I
have not been able to follow though the fop structure to workout where
to implement these changes - could anyone give my any guidance on where
to start and/or which of the approaches might be easer to implement
given the way fop works.

(I am using FOP 0.20.5 on the Sun JDK 1.4 under windows XP)

Thank you,


Reply via email to