From ff71be793d843420bb1fcdc4ddbc6f12bdb9831a Mon Sep 17 00:00:00 2001 From: Jonas Jenwald Date: Fri, 30 Jul 2021 16:15:41 +0200 Subject: [PATCH] When no "V" entry exists, let the fieldValue fallback to the "DV" entry (issue 13823) --- src/core/annotation.js | 6 ++++++ test/pdfs/issue13823.pdf.link | 1 + test/test_manifest.json | 8 ++++++++ 3 files changed, 15 insertions(+) create mode 100644 test/pdfs/issue13823.pdf.link diff --git a/src/core/annotation.js b/src/core/annotation.js index 7fce8cc3c..197012cd3 100644 --- a/src/core/annotation.js +++ b/src/core/annotation.js @@ -1193,6 +1193,12 @@ class WidgetAnnotation extends Annotation { }); data.defaultFieldValue = this._decodeFormValue(defaultFieldValue); + // When no "V" entry exists, let the fieldValue fallback to the "DV" entry + // (fixes issue13823.pdf). + if (fieldValue === undefined && data.defaultFieldValue !== null) { + data.fieldValue = data.defaultFieldValue; + } + data.alternativeText = stringToPDFString(dict.get("TU") || ""); const defaultAppearance = diff --git a/test/pdfs/issue13823.pdf.link b/test/pdfs/issue13823.pdf.link new file mode 100644 index 000000000..040436b9a --- /dev/null +++ b/test/pdfs/issue13823.pdf.link @@ -0,0 +1 @@ +https://github.com/mozilla/pdf.js/files/6907771/Formular_T_default.pdf diff --git a/test/test_manifest.json b/test/test_manifest.json index 5dc6d9881..705c10dc9 100644 --- a/test/test_manifest.json +++ b/test/test_manifest.json @@ -1038,6 +1038,14 @@ "enableXfa": true, "type": "eq" }, + { "id": "issue13823", + "file": "pdfs/issue13823.pdf", + "md5": "8ca53bba9b2c68f5cd87f13a963e6b6a", + "rounds": 1, + "link": true, + "type": "eq", + "forms": true + }, { "id": "xfa_bug1718521_1", "file": "pdfs/xfa_bug1718521_1.pdf", "md5": "9b89dd9e6a4c6c3258ca24debd806863",