Posted: 2 Mar 2020 7:06 EST Last activity: 6 Apr 2020 6:54 EDT
Page Breaks in PDF not being applied since Pega 8 Upgrade
We have until recently used Pega 7.2.2, and our application has relied on browser built in PDF generation functionality to comply with business needs, because the HTMLToPDF activity was not satisfactory.
To ensure the generated PDF applied page breaks on predetermined places, we created a section which contained a Dynamic Layout with two content CSS classes.
Within our application skin we added an additional style sheet containing the following css:
I'm not sure if it would help your case, since it looks like you tried the inline page-break-after. But we got it working by updating the HTML correspondence rule to have it inline. CSS classes wouldn't work, no matter how much we tried.
Thanks for your input Tom, I see the similarities between our issues.
Thankfully, we managed to resolve our issue. We are unaware of why, but since our upgrade to Pega 8, the "display:flex" tags disabled any embedded layouts from applying "page-break-before:always". We could investigate the cause by doing a deeper analysis of our Pega 7 reference client, but we have chosen not to prioritize this at the moment.
With this knowledge, we rebuilt our section to HTML, directly referencing the page-break CSS class with as little added as possible. This is to avoid Pega applying OOTB css classes, and we ensured that we never referenced the HTML section within a layout. To further avoid having our page breaks embedded in displays such as inline and flex, we override an OOTB css class high up in the HTML tree. As long as we strive to apply page-breaks as high up as possible, we run a very low risk of having a "display:flex" disabling embedded page-breaks.
Our solution required a lot of rework on many of our applications sections, which due to their nature and size, can be very slow to modify. A very fortunate side-effect of our changes is that our printing times / performance has been greatly improved. It seems to us that a high degree of embedded content greatly increases print time.
We did not find any difference between applying the page-break though a CSS class or directly through HTML.