[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

[xsl] FO: How to improve page breaks


Subject: [xsl] FO: How to improve page breaks
From: Michael Müller-Hillebrand <mmh@xxxxxxxxx>
Date: Wed, 19 Feb 2014 15:44:53 +0100

Hi colleagues,

For project managers it is always simple to justify the cost savings by
avoiding DTP after having implemented a direct-to-PDF XSL-FO process. However,
editors sometimes have the impression that automated layout will never be as
good as manually fine-tuned pages. I take this as a constant challenge to
surprise users that FO processing is not only consistent but can also be
(almost as) clever as a human DTP specialist.

My current challenge is page breaks. A recurring problem is the following
situation (I use HTML for markup examples):

<div>
  <p class="heading">Some heading</p>
  <p>A first paragraph.</p>
  <img src="url" />
  <p>Even more text.</p>
  <!-- rest of content -->
</div>

This topic should flow with the rest of the content. Everything is fine as
long as the introductory <p> ends up on the same page as the following image.
But if the image is pushed to the next page, the resulting page break is at a
perceived wrong position if the first <p> has only short content. It would be
fine, though, if this <p> contains a lot of text.

We do not want to introduce user-editable attributes to manually control
page-breaks. And we want to avoid two-pass processing.

What we already did to avoid that headings appear near the bottom of a page is
the insertion of
<fo:float float="start">
 <fo:block-container height="20mm"/>
</fo:float>
at the beginning of every <p class="heading"> (apart from the obvious
keep-with-next).

This forces every heading appearing in the bottom 20mm to be pushed to the
next page.

I think I am now looking for something that keeps the heading + the following
20mm of content on the same page.

Are there other options I might have overlooked, or is FOPRunXSLText recently
mentioned by Tony Graham the way I should go?

Thanks a lot for comments,

- Michael

--
Michael M|ller-Hillebrand
mmh@xxxxxxxxx


Current Thread