Forum Bugs

Using page-break-after: avoid cause a page break with prince v14

notafius
With prince v13 this still works fine but now that we are upgrading to prince v14 we can see a case where we use to have a code like below causing

.pagetitle, .hd {
   page-break-after: avoid;
   page-break-inside: avoid;
}


a page break instead of avoiding it. I have attached a example code sample to replicate the error. Hope that helps to find out what is happening.

Thanks :)
  1. page-break-prince14.zip6.3 kB

Edited by notafius

howcome
I suspect Prince tries to avoid breaking after .pagetitle (as instructed) but there are so many such elements in your example that it's impossible not to break. In the process of trying to avoid breaks, elements are moved to the next page, thereby causing what appears to be page breaks.

In this particular case, it's better to not instruct Prince to avoid page breaks after .pagetitle; this results in a normal rendition.

It's probably something Prince should fix, though.

Edited by howcome

happyfanfare
With that CSS, you’re preventing a break between every list item in your TOC.

A mystery factor here is that the default style sheet for Prince will also avoid breaking after any element that is a header : h1, h2, h3, h4, etc. That’s locking up everything in your markup.

If you wish to explcitly allow a break between the h1 and your list, you’ll need to put a `break-after: auto` on the h1 instead of a `break-before: auto` on your `.pagetitle`. Though, seems to me that howcome has the better idea.
noc
We are also getting this issue since upgrading to Prince 14 and it is causing a lot of trouble for our customers.

I believe the issue does not occur on the MacOS version of Prince, but only on the Linux version. I may be wrong about this, but so far we cannot replicate the issue locally, while it is consistent in our production and test servers running the same web application but different hardware to the local environment.
howcome
@noc, could you post files that expose the problem in your production environment?

Edited by howcome

notaf07
With my source code example provided here I can replicate the error also for MacOS, so I believe this is a general issue.
My solution for my case is that I removed the page-break code based of Howcome suggestion in this bug report and it works for both version 13 and 14 of princexml.