Skip to content

set_auto_page_break: raise a clear error for a negative margin - #2084

Merged
andersonhc merged 1 commit into
py-pdf:masterfrom
RavSinghChandan:page-break-margin-negative
Oct 29, 2026
Merged

andersonhc merged 1 commit into
py-pdf:masterfrom
RavSinghChandan:page-break-margin-negative

Conversation

@RavSinghChandan

Copy link
Copy Markdown

set_auto_page_break(True, margin=-20) placed the page break 20 mm below the bottom edge of the page, so the last lines before each break were written off the page and lost. It now raises ValueError: Bottom margin must be zero or a positive number, like set_line_width() does for a negative width.

set_margin() passes its value to set_auto_page_break() too. It now does that first, so a negative margin raises before any margin is changed.

  • A unit test is covering the code added / modified by this PR
  • A mention of the change is present in CHANGELOG.md
  • This PR is ready to be merged

@andersonhc
andersonhc merged commit a8a8035 into py-pdf:master Oct 29, 2026
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants