Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug in Class Link when using border in arguments. example border = [0,0,1, [3,2]] #2444

Closed
rsinger417 opened this issue Feb 7, 2024 · 1 comment · Fixed by #2451
Closed
Labels
is-bug From a users perspective, this is a bug - a violation of the expected behavior with a compliant PDF workflow-annotation Everything about annotating PDF files

Comments

@rsinger417
Copy link
Contributor

rsinger417 commented Feb 7, 2024

There is a bug in class Link in _markup_annotations.py
in line 328

            border_arr = [NameObject(n) for n in border[:3]]

should be

             border_arr = [NumberObject(n) for n in border[:3]]

and in line 330

                dash_pattern = ArrayObject([NameObject(n) for n in border[3]])

should be

                dash_pattern = ArrayObject([NumberObject(n) for n in border[3]])

It will pass the array as a string and not an int if it is a NameObject and will cause a warning in the Class NameObject
method renumber "Incorrect first char in cute NameObject:({self})" line 592 _base.py (pypdf.generic)

@stefan6419846 stefan6419846 added the is-bug From a users perspective, this is a bug - a violation of the expected behavior with a compliant PDF label Feb 7, 2024
@stefan6419846
Copy link
Collaborator

Thanks for the report. Do you want to submit a corresponding PR for it?

rsinger417 added a commit to rsinger417/pypdf that referenced this issue Feb 8, 2024
Change NameObject to NumberObject in lines 328 and 330 It will pass the array as a string and not an int if it is a NameObject and will cause a warning in the Class NameObject method renumber "Incorrect first char in NameObject:({self})" line 592 _base.py (pypdf.generic)
resolves py-pdf#2444 Issue
@MartinThoma MartinThoma added the workflow-annotation Everything about annotating PDF files label Feb 13, 2024
MartinThoma pushed a commit that referenced this issue Feb 13, 2024
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
is-bug From a users perspective, this is a bug - a violation of the expected behavior with a compliant PDF workflow-annotation Everything about annotating PDF files
Projects
None yet
3 participants