Forum How do I...?

Prevent blank page when page-break-inside is avoid but content is too big for one page

pdatartech
Hello all.

This is my first post in the forum. Thanks in advance for your help.
So I'm generating a document which has dynamic content based on user input. This content can grow to a size that it cannot fit on one page. Through css I have configured this content to avoid a page break. In most cases it works fine. If the rendering is nearing the end of the page and the dynamic content cannot fit in the rest of the page PrinceXML breaks the page and starts the content on the new page. But the problem is that sometimes even after starting the content from a brand new page, the page is not enough to fit the entire content so it ends up breaking inside the content anyway. Is there a way for PrinceXML to first check if that after breaking the page the content is not going to fit on the whole page then to not do the first page break?

Another problem I had with this is that if there is any content after this large dynamic content, there is a text overlap. My immediate requirement is to solve the second problem (so that the text doesn't overlap). A nice-to-have would be to enable the smarts of PrinceXML knowing that the dynamic content is not going to fit on full page so to then not do a page break before rendering it.

Please see attached files for more information. Happy to provide more information if required to help you assist me in solving the above.

Once again, I thank everyone in advance for their assistance with this.
  1. OverlapProblem.html93.9 kB
    This is the source HTML
  2. OverlapProblem.pdf79.0 kB
    Overlap can be found on page 3
  3. OverlapProblemGoogleChromePDF.pdf75.4 kB
    No overlap with Chrome print to PDF
markbrown
Hi,

The second problem appears to be caused by one or more of the clearfixes not working as expected. Unfortunately, this relates to a known problem with keeping track of the height of elements across fragmentation boundaries which I'm not sure there is easy workaround for.

For the first problem, you may be able to try the "Two-Pass" solution, using the Box Tracking API to determine whether to apply page-break-inside: avoid. With this approach you might be able to avoid the need for the clearfix and thus avoid the second problem.

Hope this helps.

Mark

Edited by markbrown

pdatartech
Okay. Not as straight forward as I thought it would be. So for the second problem would it be right to raise a bug with PrinceXML or is this a known bug to which I can add this instance? I'll have a look at the solution you have suggested for the first problem. Looks like it involves using Javascript. I'll try and revert back if I have any further questions. Thanks for your assistnace!
markbrown
I've already filed this as a bug instance myself - thanks for letting us know about it :-)