Forum How do I...?

smart page breaking

phil_flowers
I've got a following problem with page breaking in Prince:
I have 2 DIVs filled with text. First one is about 50% of page height. The second one is a little bit longer then one page. I want to force the following behavior of the second DIV for page breaking:
- Try to don't break page inside the DIV -> I want to have all DIV on one page
- If it's impossible (DIV is longer than page) leave natural breaking style

I'm using
page-break-inside: avoid;
, but the effect is unsatisfactory.
The effect is following: Prince is trying to don't break page inside the DIV, so it moved all DIV to next page. But this div is too long anyway, so it's splitted and the rest of this DIV is moved to third page.

I want to force behavior: if it's longer than page, leave the beginning of DIV on the first page, and the rest on the second one. Instead of: first DIV on the first page and empty rest of first page, almost all second DIV on the second page and the rest of the second DIV on the third page.

What I've got:


What I want:


Is there any good solution for this?
mikeday
I don't think this is possible with pure CSS at the moment. And since it is not possible to reflow layout after JavaScript, even doing it with scripting would be difficult.