Skip to content

Commit de48af7

Browse files
committed
Interpret empty annotation border as [0, 0, 0]
It fixes #20914.
1 parent 869f25a commit de48af7

3 files changed

Lines changed: 21 additions & 8 deletions

File tree

src/core/annotation.js

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1104,14 +1104,18 @@ class Annotation {
11041104
}
11051105
} else if (borderStyle.has("Border")) {
11061106
const array = borderStyle.getArray("Border");
1107-
if (Array.isArray(array) && array.length >= 3) {
1108-
this.borderStyle.setHorizontalCornerRadius(array[0]);
1109-
this.borderStyle.setVerticalCornerRadius(array[1]);
1110-
this.borderStyle.setWidth(array[2], this.rectangle);
1111-
1112-
if (array.length === 4) {
1113-
// Dash array available
1114-
this.borderStyle.setDashArray(array[3], /* forceStyle = */ true);
1107+
if (Array.isArray(array)) {
1108+
if (array.length >= 3) {
1109+
this.borderStyle.setHorizontalCornerRadius(array[0]);
1110+
this.borderStyle.setVerticalCornerRadius(array[1]);
1111+
this.borderStyle.setWidth(array[2], this.rectangle);
1112+
1113+
if (array.length === 4) {
1114+
// Dash array available
1115+
this.borderStyle.setDashArray(array[3], /* forceStyle = */ true);
1116+
}
1117+
} else if (array.length === 0) {
1118+
this.borderStyle.setWidth(0);
11151119
}
11161120
}
11171121
} else {

test/pdfs/issue20914.pdf.link

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
https://github.com/user-attachments/files/26097319/SiemensTest.PDF

test/test_manifest.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14020,5 +14020,13 @@
1402014020
"rounds": 1,
1402114021
"link": true,
1402214022
"type": "eq"
14023+
},
14024+
{
14025+
"id": "issue20914",
14026+
"file": "pdfs/issue20914.pdf",
14027+
"md5": "5740b4600e40c6fc920d38f96a74c6a5",
14028+
"rounds": 1,
14029+
"link": true,
14030+
"type": "eq"
1402314031
}
1402414032
]

0 commit comments

Comments
 (0)