mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-22 16:18:08 +02:00
[Annotation] A combo can have a value other than one in the options
When printing the pdf in #12233 in Acrobat, we can see that the combo for country is empty: it's because the V entry doesn't have to be one of the options.
This commit is contained in:
parent
533a461db0
commit
cb1638530d
1 changed files with 7 additions and 8 deletions
|
@ -1981,15 +1981,14 @@ class WidgetAnnotation extends Annotation {
|
|||
}
|
||||
|
||||
assert(typeof value === "string", "Expected `value` to be a string.");
|
||||
value = value.trim();
|
||||
|
||||
if (!this.data.combo) {
|
||||
value = value.trim();
|
||||
} else {
|
||||
// The value is supposed to be one of the exportValue.
|
||||
const option =
|
||||
this.data.options.find(({ exportValue }) => value === exportValue) ||
|
||||
this.data.options[0];
|
||||
value = (option && option.displayValue) || "";
|
||||
if (this.data.combo) {
|
||||
// The value can be one of the exportValue or any other values.
|
||||
const option = this.data.options.find(
|
||||
({ exportValue }) => value === exportValue
|
||||
);
|
||||
value = (option && option.displayValue) || value;
|
||||
}
|
||||
|
||||
if (value === "") {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue