Skip to content

Commit

Permalink
BUG: Use NumberObject for /Border elements of annotations (#2451)
Browse files Browse the repository at this point in the history
As defined in Table 164 – Entries common to all annotation dictionaries, the /Border Array consists of NumberObjects. Previously, pypdf used NameObject which is wrong.

The previous version caused a warning in the class NameObject: "Incorrect first char in NameObject:({self})".

Fixes #2444
  • Loading branch information
rsinger417 committed Feb 13, 2024
1 parent 8cacb0f commit b7bfd0d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pypdf/annotations/_markup_annotations.py
Original file line number Diff line number Diff line change
Expand Up @@ -325,9 +325,9 @@ def __init__(

border_arr: BorderArrayType
if border is not None:
border_arr = [NameObject(n) for n in border[:3]]
border_arr = [NumberObject(n) for n in border[:3]]
if len(border) == 4:
dash_pattern = ArrayObject([NameObject(n) for n in border[3]])
dash_pattern = ArrayObject([NumberObject(n) for n in border[3]])
border_arr.append(dash_pattern)
else:
border_arr = [NumberObject(0)] * 3
Expand Down

0 comments on commit b7bfd0d

Please sign in to comment.