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

[api-minor] Include export value for checkboxes

This commit is contained in:
bion 2018-07-06 17:51:10 -07:00
parent 66ffdc4c5b
commit c31ddf7edc
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) {