1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-22 16:18:08 +02:00

Merge pull request #9874 from boundlesshq/master

[api-minor] Include export value for checkboxes
This commit is contained in:
Tim van der Meij 2018-08-03 23:43:23 +02:00 committed by GitHub
commit f19ee127a3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 50 additions and 5 deletions

View file

@ -742,7 +742,7 @@ class ButtonWidgetAnnotation extends WidgetAnnotation {
this.data.pushButton = this.hasFieldFlag(AnnotationFieldFlag.PUSHBUTTON);
if (this.data.checkBox) {
this._processCheckBox();
this._processCheckBox(params);
} else if (this.data.radioButton) {
this._processRadioButton(params);
} else if (this.data.pushButton) {
@ -752,11 +752,29 @@ class ButtonWidgetAnnotation extends WidgetAnnotation {
}
}
_processCheckBox() {
if (!isName(this.data.fieldValue)) {
_processCheckBox(params) {
if (isName(this.data.fieldValue)) {
this.data.fieldValue = this.data.fieldValue.name;
}
const customAppearance = params.dict.get('AP');
if (!isDict(customAppearance)) {
return;
}
this.data.fieldValue = this.data.fieldValue.name;
const exportValueOptionsDict = customAppearance.get('D');
if (!isDict(exportValueOptionsDict)) {
return;
}
const exportValues = exportValueOptionsDict.getKeys();
const hasCorrectOptionCount = exportValues.length === 2;
if (!hasCorrectOptionCount) {
return;
}
this.data.exportValue = exportValues[0] === 'Off' ?
exportValues[1] : exportValues[0];
}
_processRadioButton(params) {