Repository navigation
ENH: Allow setting border color for rectangle annotations - #4297
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4297 +/- ##
=======================================
Coverage 98.65% 98.65%
=======================================
Files 59 59
Lines 11962 11964 +2
Branches 2270 2271 +1
=======================================
+ Hits 11801 11803 +2
Misses 84 84
Partials 77 77 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Would it be useful to have the new Color class in this PR? See here: https://github.com/py-pdf/pypdf/blob/main/pypdf/generic/_color.py |
stefan6419846
left a comment
There was a problem hiding this comment.
I do not agree that we should use a black border by default. Instead, we should provide a way for the user to pass a border color and default it to the old behavior (to retain backwards-compatibility).
This would require us to refine the public API for the Does the class really have any benefits over passing hex-based strings here? |
`border_color` now defaults to None, preserving the previous output. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Ak4shh <akashposa40@gmail.com>
|
Done. border_color now defaults to None, so /C is omitted as before. |
Co-authored-by: Stefan <96178532+stefan6419846@users.noreply.github.com>
Fixes #1649.
Rectangle annotations omitted
/C, which viewers can interpret as a transparent border.Rectanglenow defaults to a black border and accepts a keyword-onlyborder_colorparameter. PassingNonepreserves the previous behavior of omitting/C. Interior color remains independently configurable.Added tests for the default border and PDF round trips with black, red, and omitted border colors. Updated the annotation guide, including the spelling of
interior_color.Validation: 41 annotation tests passed; Ruff and focused mypy passed. PyMuPDF rendering confirmed visible borders for black and red and no border when the color is omitted. Acrobat and browser viewers were not checked.