Support Annotations with corrupt /BS-entries
There's obviously a few things wrong with the Annotations in the referenced PDF document, however parsing of an Annotation shouldn't just break if the /BS-entry isn't a dictionary.
This commit is contained in:
parent
07aa706f1c
commit
63eb8991a3
@ -999,12 +999,15 @@ class Annotation {
|
||||
}
|
||||
if (borderStyle.has("BS")) {
|
||||
const dict = borderStyle.get("BS");
|
||||
const dictType = dict.get("Type");
|
||||
|
||||
if (!dictType || isName(dictType, "Border")) {
|
||||
this.borderStyle.setWidth(dict.get("W"), this.rectangle);
|
||||
this.borderStyle.setStyle(dict.get("S"));
|
||||
this.borderStyle.setDashArray(dict.getArray("D"));
|
||||
if (dict instanceof Dict) {
|
||||
const dictType = dict.get("Type");
|
||||
|
||||
if (!dictType || isName(dictType, "Border")) {
|
||||
this.borderStyle.setWidth(dict.get("W"), this.rectangle);
|
||||
this.borderStyle.setStyle(dict.get("S"));
|
||||
this.borderStyle.setDashArray(dict.getArray("D"));
|
||||
}
|
||||
}
|
||||
} else if (borderStyle.has("Border")) {
|
||||
const array = borderStyle.getArray("Border");
|
||||
|
1
test/pdfs/pypdf2332.pdf.link
Normal file
1
test/pdfs/pypdf2332.pdf.link
Normal file
@ -0,0 +1 @@
|
||||
https://github.com/py-pdf/pypdf/files/13606678/output.pdf
|
@ -4902,6 +4902,15 @@
|
||||
"rounds": 1,
|
||||
"type": "eq"
|
||||
},
|
||||
{ "id": "pypdf2332",
|
||||
"file": "pdfs/pypdf2332.pdf",
|
||||
"md5": "883d2cf4d0ed16e32c917498fe9843dd",
|
||||
"rounds": 1,
|
||||
"link": true,
|
||||
"lastPage": 1,
|
||||
"type": "eq",
|
||||
"annotations": true
|
||||
},
|
||||
{ "id": "issue6151",
|
||||
"file": "pdfs/issue6151.pdf",
|
||||
"md5": "926f8c6b25e6f0978759f7947d70e079",
|
||||
|
Loading…
Reference in New Issue
Block a user