py-pdf / fpdf2

Simple PDF generation for Python
https://py-pdf.github.io/fpdf2/
GNU Lesser General Public License v3.0
993 stars 227 forks source link

Added support for CSS page break properties + bugfixes #1209

Closed Lucas-C closed 1 week ago

Lucas-C commented 2 weeks ago

This PR also fixes a bug introduced in PR #1207 regarding font_size_pt set in the current graphics state when using .local_context().

Before merging this PR, this bug is visible on the master branch in the following reference files:

I did not see this regression in PR #1207 because I misread the positioning of the PDFs in the HTML page produced by scripts/compare-changed-pdfs.py: in order to avoid this to happen again, I added an explicit legend at the top of the page, explaining what are the PDFs in the left & right columns.

Finally, this PR also fixes automatic page break when an image, inserted through .write_html() without height attribute, does not have enough vertical space to be rendered on a page.

Checklist:

By submitting this pull request, I confirm that my contribution is made under the terms of the GNU LGPL 3.0 license.

Lucas-C commented 2 weeks ago

If you want to review this @gmischler & @andersonhc, I'll be happy to have your feedbacks 🙂

Else I'll merge this later this week.

Lucas-C commented 1 week ago

@gmischler: would you like to take the time to review this PR more in-depths?