When the page-break-avoid property is applied to a table, it instructs the formatting engine not to break the page within the table. It's important to understand that formatters typically operate in a "go forward" manner, meaning they do not go back and try things again.
In this scenario, the entire table has page-break-avoid set, and the table itself spans about 2.5 physical pages. The formatter first attempts to fit the table on the current page but fails due to its length. It then moves to a new blank page and tries again, repeating this process until it finally places the table on a subsequent page.
However, there are additional constraints present, such as using page-break-after="avoid" on rows. This further complicates the layout and can result in the rows not fitting on a single page.
The combination of these rules creates a highly restricted set of conditions. It seems contradictory to request that a table not break inside it while also keeping all rows together, especially with a lengthy table like the one described.
There is also a concerning set of rules specified for paragraph tags when it comes to pagination. It essentially mandates that at least 10 lines must be kept together without any breaks before or after. This could lead to similar issues if multiple paragraphs adhere to these guidelines in sequence.
Your statement regarding the visibility of table headers on all pages seems to refer to ensuring they appear whenever the table is placed, rather than every single page. Removing some of the constraints mentioned, particularly those related to avoiding page breaks within tables or rows, should improve the display of table headers without unnecessary blank pages.