WeasyPrint version: 68.1
Problem:
We are generating PDFs from a combined HTML document using mkdocs-with-pdf. All content is wrapped inside <article> and <section> tags. We need to insert manual page breaks at specific positions but break-before: page is being ignored on elements inside <article> containers.
What we tried:
Empty div:
<div style="break-before: page; page-break-before: always;"></div>
Div with non-breaking space:
<div style="break-before: page; page-break-before: always;"> </div>
CSS class:
css.page-break {
break-before: page !important;
page-break-before: always !important;
display: block !important;
height: 0;
}
Hidden h2 heading with zero height and font-size:
<h2 class="page-break-hidden"> </h2>
h2.page-break-hidden {
break-before: page !important;
height: 0 !important;
font-size: 0 !important;
line-height: 0 !important;
visibility: hidden !important;
}
None of these approaches work inside an <article> container.
What works:
break-before: page on actual content headings (<h1>, <h2>) with visible text is respected. But this causes side effects with running headers via string-set.
Minimal reproduction:
<article>
<p>Some content here.</p>
<div style="break-before: page;"> </div>
<p>This should start on a new page but does not.</p>
</article>
Question:
Is there a supported way to force a manual page break at an arbitrary position inside an <article> container?
WeasyPrint version: 68.1
Problem:
We are generating PDFs from a combined HTML document using mkdocs-with-pdf. All content is wrapped inside
<article>and<section>tags. We need to insert manual page breaks at specific positions but break-before: page is being ignored on elements inside<article>containers.What we tried:
Empty div:
Div with non-breaking space:
CSS class:
Hidden h2 heading with zero height and font-size:
None of these approaches work inside an
<article>container.What works:
break-before: page on actual content headings (
<h1>,<h2>) with visible text is respected. But this causes side effects with running headers via string-set.Minimal reproduction:
Question:
Is there a supported way to force a manual page break at an arbitrary position inside an
<article>container?