diff --git a/src/core/annotation.js b/src/core/annotation.js index 3a7c9ccdf..e970dc34c 100644 --- a/src/core/annotation.js +++ b/src/core/annotation.js @@ -3511,6 +3511,18 @@ class ChoiceWidgetAnnotation extends WidgetAnnotation { } } + // It's a workaround for the issue #19083. + // Normally a choice widget is a mix of a text field and a listbox, + // So in the case where the V entry isn't an option we should just set it + // as the text field value. + if (this.data.options.length === 0 && this.data.fieldValue.length > 0) { + // If there are no options, then the field value is the only option. + this.data.options = this.data.fieldValue.map(value => ({ + exportValue: value, + displayValue: value, + })); + } + // Process field flags for the display layer. this.data.combo = this.hasFieldFlag(AnnotationFieldFlag.COMBO); this.data.multiSelect = this.hasFieldFlag(AnnotationFieldFlag.MULTISELECT); diff --git a/test/pdfs/.gitignore b/test/pdfs/.gitignore index 4bf8b6554..0d392f67c 100644 --- a/test/pdfs/.gitignore +++ b/test/pdfs/.gitignore @@ -681,3 +681,4 @@ !issue18894.pdf !bug1922766.pdf !issue18956.pdf +!issue19083.pdf diff --git a/test/pdfs/issue19083.pdf b/test/pdfs/issue19083.pdf new file mode 100755 index 000000000..508b7db96 Binary files /dev/null and b/test/pdfs/issue19083.pdf differ diff --git a/test/test_manifest.json b/test/test_manifest.json index a7435ad0f..508e2af7d 100644 --- a/test/test_manifest.json +++ b/test/test_manifest.json @@ -10766,5 +10766,14 @@ "rounds": 1, "type": "eq", "link": true + }, + { + "id": "issue19083", + "file": "pdfs/issue19083.pdf", + "md5": "2e2aa6c1904c1e6a89a5a6ec95d5ce7e", + "rounds": 1, + "forms": true, + "talos": false, + "type": "eq" } ]