Forum How do I...?

page-breaks doubling up in certain conditions.

BillPearmain
Hi.

We have a reporting module which generates HTML output. This is converted to a PDF using Prince. The basic structure of the page is one large table, which contains more tables which are generated from data which is retrieved from a database. We have a table which makes up a header title for each section and this table has the following css style

page-break-before: always;


For most cases this works correctly. however, in the event that the previous page's content has ended close to the bottom edge of the page, a blank page is inserted. I have tested this in both version 6 and 7 with the same issue.

The content for each table is dynamic so using padding or margins to move the content away from the bottom of the page isn't an option, as the amount of data in the report can change.

Thank you.
mikeday
Blank pages can sometimes occur with very long tables with "page-break-before: avoid" or similar rules applied, or with "page-break-before: left" or right to force a double page break. Are you using either of these?
BillPearmain
mikeday wrote:
Blank pages can sometimes occur with very long tables with "page-break-before: avoid" or similar rules applied, or with "page-break-before: left" or right to force a double page break. Are you using either of these?


Hi Mike, thanks for your reply.

I've checked the generated HTML output and I haven't found any of those styles applied to tables. The page break styling on our subtitle tables have "page-break-before: always". The tables which contain report content all have "page-break-inside: avoid" and "page-break-after: avoid". These are the only page-break rules in the document.

The blank page occurs when the preceeding content table finishes roughly at the end of the page. The next page is bank and then the subtitle table appears on the page after that.

Thanks, Bill
mikeday
Using "page-break-inside: avoid" can cause unwanted page breaks in situations where the table is too long to fit on one page.
BillPearmain
mikeday wrote:
Using "page-break-inside: avoid" can cause unwanted page breaks in situations where the table is too long to fit on one page.


I've tried this suggestion but it had no effect on the problem. Thanks.
mikeday
Are you able to email me (mikeday@yeslogic.com) some simple HTML and CSS to investigate the problem?
BillPearmain
mikeday wrote:
Are you able to email me (mikeday@yeslogic.com) some simple HTML and CSS to investigate the problem?


Thanks, I've sent some files to you.
mikeday
The page breaks were caused by <br/> elements used to separate tables, while the tables had page-break-before: always applied.
vijay.v
I am using same style but getting blank area when the table breaks to new page, how should avoid this ?

https://prnt.sc/GOGDzPfMBtDO