We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
My HTML is the following.
<!doctype html> <meta charset="utf-8" /> <style> @page { size: A4; /*margin: 3cm;*/ } body { font-size: 20pt; } #s1 { page-break-before: always; font-size: 16pt; } </style> <section id="s0"> <h1>1111</h1> </section> <section id="s1"> <ul> <li> <div>ITEM1</div> <ul> <li> <div>ITEM1-1</div> </li> <li> <div>ITEM1-2</div> </li> <li> <div>ITEM1-2</div> </li> </ul> </li> <li> <div>ITEM2</div> </li> <li> <div>ITEM3</div> </li> <li> <div>ITEM4</div> <ul> <li> <div>ITEM4-1</div> <ul> <li> <div>ITEM4-1-1</div> </li> <li> <div>ITEM4-1-2</div> </li> <li> <div>ITEM4-1-3</div> </li> </ul> </li> <li> <div>ITEM4-2</div> <ul> <li> <div>ITEM4-2-1</div> </li> <li> <div>ITEM4-2-2</div> </li> <li> <div>ITEM4-2-3</div> </li> </ul> </li> <li> <div>ITEM4-3</div> <ul> <li> <div>ITEM4-3-1</div> </li> <li> <div>ITEM4-3-2</div> </li> <li> <div>ITEM4-3-3</div> </li> </ul> </li> <li> <div>ITEM4-4</div> <ul> <li> <div>ITEM4-4-1</div> </li> <li> <div>ITEM4-4-2</div> </li> <li> <div>ITEM4-4-3</div> </li> </ul> </li> <li> <div>ITEM4-5</div> <ul> <li> <div>ITEM4-5-1</div> </li> <li> <div>ITEM4-5-2</div> </li> <li> <div>ITEM4-5-3</div> </li> </ul> </li> <li> <div>ITEM4-6</div> <ul> <li> <div>ITEM4-6-1</div> </li> <li> <div>ITEM4-6-2</div> </li> <li> <div>ITEM4-6-3</div> </li> </ul> </li> <li> <div>ITEM4-7</div> <ul> <li> <div>ITEM4-7-1</div> </li> <li> <div>ITEM4-7-2</div> </li> <li> <div>ITEM4-7-3</div> </li> </ul> </li> <li> <div>ITEM4-8</div> <ul> <li> <div>ITEM4-8-1</div> </li> <li> <div>ITEM4-8-2</div> </li> <li> <div>ITEM4-8-3</div> </li> </ul> </li> <li> <div>ITEM4-9</div> <ul> <li> <div>ITEM4-9-1</div> </li> <li> <div>ITEM4-9-2</div> </li> <li> <div>ITEM4-9-3</div> </li> </ul> </li> <li> <div>ITEM4-10</div> <ul> <li> <div>ITEM4-10-1</div> </li> <li> <div>ITEM4-10-2</div> </li> <li> <div>ITEM4-10-3</div> </li> </ul> </li> <li> <div>ITEM4-11</div> <ul> <li> <div>ITEM4-11-1</div> </li> <li> <div>ITEM4-11-2</div> </li> <li> <div>ITEM4-11-3</div> </li> </ul> </li> <li> <div>ITEM4-12</div> <ul> <li> <div>ITEM4-12-1</div> </li> <li> <div>ITEM4-12-2</div> </li> <li> <div>ITEM4-12-3</div> </li> </ul> </li> </ul> </li> </ul> </section>
Generated PDF file is
Uncomment and add margin to the page.
@page { size: A4; margin: 3cm; }
An unintended page break has been added after item3.
If I add an element with a margin greater than the page margin, no page break will be added.
<!doctype html> <meta charset="utf-8" /> <style> @page { size: A4; margin: 3cm; } body { font-size: 20pt; } #s1 { page-break-before: always; font-size: 16pt; } .margin { margin: 0 0 3.01cm 0; } </style> <section id="s0"> <h1>1111</h1> </section> <section id="s1"> <div class="margin"></div> <ul>...</ul> </section>
If I change 3.01cm to 3cm (same as page margin), a page break will be added.
I could avoid adding page breaks, but it would create an extra margin. To remove the extra margin, add negative margin to next element.
.margin + * { margin-top: -3.01cm; }
# weasyprint --version WeasyPrint version 54.1
The text was updated successfully, but these errors were encountered:
Thanks for this bug report! The bug has already been fixed by 9b0a672 and will be included in version 54.2.
Sorry, something went wrong.
No branches or pull requests
My HTML is the following.
Generated PDF file is
Uncomment and add margin to the page.
Generated PDF file is
An unintended page break has been added after item3.
Workaround
If I add an element with a margin greater than the page margin, no page break will be added.
If I change 3.01cm to 3cm (same as page margin), a page break will be added.
I could avoid adding page breaks, but it would create an extra margin.
To remove the extra margin, add negative margin to next element.
Version
The text was updated successfully, but these errors were encountered: