diff --git a/src/core/annotation.js b/src/core/annotation.js index cb6d9d2be..d4c28cf3a 100644 --- a/src/core/annotation.js +++ b/src/core/annotation.js @@ -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"); diff --git a/test/pdfs/pypdf2332.pdf.link b/test/pdfs/pypdf2332.pdf.link new file mode 100644 index 000000000..4e9eae42a --- /dev/null +++ b/test/pdfs/pypdf2332.pdf.link @@ -0,0 +1 @@ +https://github.com/py-pdf/pypdf/files/13606678/output.pdf diff --git a/test/test_manifest.json b/test/test_manifest.json index 375ef75d7..5b9480fd7 100644 --- a/test/test_manifest.json +++ b/test/test_manifest.json @@ -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",