Skip to content

ink_annotation: compute the rectangle's x from the x coordinates - #2068

Merged
andersonhc merged 1 commit into
py-pdf:masterfrom
RavSinghChandan:ink-annotation-rect
Oct 28, 2026
Merged

andersonhc merged 1 commit into
py-pdf:masterfrom
RavSinghChandan:ink-annotation-rect

Conversation

@RavSinghChandan

Copy link
Copy Markdown

FPDF.ink_annotation() builds the annotation rectangle with x=y_min, so the horizontal position of /Rect came from the y coordinates of the path. The rectangle did not enclose the drawn path: in test/ink_annotation.pdf, the path spans x = 113-283pt but /Rect was [629.29 629.29 799.37 771.02], entirely to the right of the 595pt-wide A4 page. Viewers use /Rect to place and hit-test the annotation.

It now uses x=x_min. The two reference PDFs that contain an ink annotation (test/ink_annotation.pdf, test/encryption/encryption_aes256.pdf) change only in /Rect (now [113.39 629.29 283.46 771.02]) and the derived /ID. Added test_ink_annotation_rect_encloses_the_path next to test_ink_annotation, and a CHANGELOG entry.

@andersonhc
andersonhc merged commit 4995a72 into py-pdf:master Oct 28, 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