Skip to content

Commit

Permalink
Annotation - For checkboxes, get field value from AS (if any) instead…
Browse files Browse the repository at this point in the history
… of V (bug 1722036)

  - it aims to fix https://bugzilla.mozilla.org/show_bug.cgi?id=1722036.
  - AS and V should share the same value for checkbox: it's at least what the specs say;
  - the pdf in the above bug opens correctly in Acrobat so it likely means that AS is chosen over V.
  • Loading branch information
calixteman committed Sep 17, 2021
1 parent d6a2786 commit 1279880
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/core/annotation.js
Original file line number Diff line number Diff line change
Expand Up @@ -2083,6 +2083,12 @@ class ButtonWidgetAnnotation extends WidgetAnnotation {
return;
}

if (this.appearance) {
// See https://bugzilla.mozilla.org/show_bug.cgi?id=1722036
// If we've an AS and V then take AS.
this.data.fieldValue = this._decodeFormValue(params.dict.get("AS"));
}

const exportValues = normalAppearance.getKeys();
if (!exportValues.includes("Off")) {
// The /Off appearance is optional.
Expand Down
1 change: 1 addition & 0 deletions test/pdfs/bug1722036.pdf.link
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
https://bugzilla.mozilla.org/attachment.cgi?id=9232845
7 changes: 7 additions & 0 deletions test/test_manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -5899,5 +5899,12 @@
"rounds": 1,
"lastPage": 1,
"type": "eq"
},
{ "id": "bug1722036",
"file": "pdfs/bug1722036.pdf",
"md5": "bbc7f62ca85609c97069bd3ce2658288",
"rounds": 1,
"link": true,
"type": "eq"
}
]

0 comments on commit 1279880

Please sign in to comment.