From de48af76d47ee78cec7a71db62f00541f02d4d81 Mon Sep 17 00:00:00 2001 From: calixteman Date: Sun, 22 Mar 2026 14:41:47 +0100 Subject: [PATCH] Interpret empty annotation border as [0, 0, 0] It fixes #20914. --- src/core/annotation.js | 18 +++++++++++------- test/pdfs/issue20914.pdf.link | 1 + test/test_manifest.json | 8 ++++++++ 3 files changed, 20 insertions(+), 7 deletions(-) create mode 100644 test/pdfs/issue20914.pdf.link diff --git a/src/core/annotation.js b/src/core/annotation.js index bc31efeff..b659fd1f5 100644 --- a/src/core/annotation.js +++ b/src/core/annotation.js @@ -1104,14 +1104,18 @@ class Annotation { } } else if (borderStyle.has("Border")) { const array = borderStyle.getArray("Border"); - if (Array.isArray(array) && array.length >= 3) { - this.borderStyle.setHorizontalCornerRadius(array[0]); - this.borderStyle.setVerticalCornerRadius(array[1]); - this.borderStyle.setWidth(array[2], this.rectangle); + if (Array.isArray(array)) { + if (array.length >= 3) { + this.borderStyle.setHorizontalCornerRadius(array[0]); + this.borderStyle.setVerticalCornerRadius(array[1]); + this.borderStyle.setWidth(array[2], this.rectangle); - if (array.length === 4) { - // Dash array available - this.borderStyle.setDashArray(array[3], /* forceStyle = */ true); + if (array.length === 4) { + // Dash array available + this.borderStyle.setDashArray(array[3], /* forceStyle = */ true); + } + } else if (array.length === 0) { + this.borderStyle.setWidth(0); } } } else { diff --git a/test/pdfs/issue20914.pdf.link b/test/pdfs/issue20914.pdf.link new file mode 100644 index 000000000..913f90ffc --- /dev/null +++ b/test/pdfs/issue20914.pdf.link @@ -0,0 +1 @@ +https://github.com/user-attachments/files/26097319/SiemensTest.PDF diff --git a/test/test_manifest.json b/test/test_manifest.json index c86559d01..6a5cc4e10 100644 --- a/test/test_manifest.json +++ b/test/test_manifest.json @@ -14020,5 +14020,13 @@ "rounds": 1, "link": true, "type": "eq" + }, + { + "id": "issue20914", + "file": "pdfs/issue20914.pdf", + "md5": "5740b4600e40c6fc920d38f96a74c6a5", + "rounds": 1, + "link": true, + "type": "eq" } ]