I didn’t think keep-with-previous would have more “power” than the end of the page. If so, it means that I need to stop using it for now or at least implement a workaround into my generation logic as I don’t want to use trunk for (soon to be) production code. I will revisit this later when a new release-version of FOP is available.


Thanks for the quick reply… Dominik.


From: Georg Datterl [mailto:georg.datterl@geneon.de]
Sent: Montag, 05. Juli 2010 14:47
To: fop-users@xmlgraphics.apache.org
Subject: AW: keep-with-previous and page break


Hi Dominik,


Basically, you tell FOP not to insert breaks and FOP does exactly that. It always keeps your blocks with their predecessors. If you want your content to flow to the next page, remove the keep-with-previous. If you want breaks only between special images, remove the keep there.


If you want as many images on one page as possible, but only up to a full page height, then get rid of your keep-with-previous, put all your content into one block, mark this block with keep-together.within-page=”5” and get FOP trunk, where integer keeps are already implemented (a little bit).




Georg Datterl


------ Kontakt ------


Georg Datterl


Geneon media solutions gmbh

Gutenstetter Straße 8a

90449 Nürnberg


HRB Nürnberg: 17193

Geschäftsführer: Yong-Harry Steiert


Tel.: 0911/36 78 88 - 26

Fax: 0911/36 78 88 - 20




Weitere Mitglieder der Willmy MediaGroup:


IRS Integrated Realization Services GmbH:    www.irs-nbg.de

Willmy PrintMedia GmbH:                            www.willmy.de

Willmy Consult & Content GmbH:                 www.willmycc.de


Von: Dominik Stadler [mailto:dominik.stadler@dynatrace.com]
Gesendet: Montag, 5. Juli 2010 14:30
An: fop-users@xmlgraphics.apache.org
Betreff: keep-with-previous and page break




I am creating automated PDF documents using FOP 0.95. I tried to use keep-with-previous=“always“ to keep related content near each other when rendering multi-page documents.


FOP renders as much related content as possible, but does not overflow the rest to the next page, but simply ignores it, so if I have 10 images, where only the first 3 fit on the page, the other 7 are simply not visible in the PDF.


Is this the intended behaviour? Is there another way to tell FOP that the relation is there, but it still should do page breaks if the page is filled?


As I do not know how much content fits on a page, I would not like to start setting/unsetting keep-with-previous on my own, but would expect the renderer to do page breaks if keeping on one page is not possible.


The XSL-FO looks roughly like this, all elements use “keep-with-previous” to not have page-breaks between the heading and the images.