1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-19 22:58:07 +02:00

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:
Jonas Jenwald 2023-12-09 10:30:23 +01:00
parent 07aa706f1c
commit 63eb8991a3
3 changed files with 18 additions and 5 deletions

View file

@ -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");