diff --git a/src/core/annotation.js b/src/core/annotation.js index c87f99f4b..75d8b5c1a 100644 --- a/src/core/annotation.js +++ b/src/core/annotation.js @@ -1888,6 +1888,7 @@ class WidgetAnnotation extends Annotation { data.fieldFlags = 0; } + data.password = this.hasFieldFlag(AnnotationFieldFlag.PASSWORD); data.readOnly = this.hasFieldFlag(AnnotationFieldFlag.READONLY); data.required = this.hasFieldFlag(AnnotationFieldFlag.REQUIRED); data.hidden = @@ -2261,8 +2262,7 @@ class WidgetAnnotation extends Annotation { } async _getAppearance(evaluator, task, intent, annotationStorage) { - const isPassword = this.hasFieldFlag(AnnotationFieldFlag.PASSWORD); - if (isPassword) { + if (this.data.password) { return null; } const storageEntry = annotationStorage?.get(this.data.id); @@ -2962,7 +2962,7 @@ class TextWidgetAnnotation extends WidgetAnnotation { value: this.data.fieldValue, defaultValue: this.data.defaultFieldValue || "", multiline: this.data.multiLine, - password: this.hasFieldFlag(AnnotationFieldFlag.PASSWORD), + password: this.data.password, charLimit: this.data.maxLen, comb: this.data.comb, editable: !this.data.readOnly, diff --git a/src/display/annotation_layer.js b/src/display/annotation_layer.js index 386629672..1b55f3d51 100644 --- a/src/display/annotation_layer.js +++ b/src/display/annotation_layer.js @@ -1286,7 +1286,7 @@ class TextWidgetAnnotationElement extends WidgetAnnotationElement { } } else { element = document.createElement("input"); - element.type = "text"; + element.type = this.data.password ? "password" : "text"; element.setAttribute("value", fieldFormattedValues ?? textContent); if (this.data.doNotScroll) { element.style.overflowX = "hidden"; diff --git a/test/pdfs/.gitignore b/test/pdfs/.gitignore index f9e0cd705..3001e51b4 100644 --- a/test/pdfs/.gitignore +++ b/test/pdfs/.gitignore @@ -609,6 +609,7 @@ !issue16021.pdf !bug1770750.pdf !issue16063.pdf +!issue19389.pdf !issue16067.pdf !bug1820909.1.pdf !issue16221.pdf diff --git a/test/pdfs/issue19389.pdf b/test/pdfs/issue19389.pdf new file mode 100644 index 000000000..44a95188e Binary files /dev/null and b/test/pdfs/issue19389.pdf differ diff --git a/test/test_manifest.json b/test/test_manifest.json index 759b73237..dda23d1d9 100644 --- a/test/test_manifest.json +++ b/test/test_manifest.json @@ -1251,6 +1251,14 @@ "type": "eq", "about": "XObject with BBox array containing indirect object." }, + { + "id": "issue19389", + "file": "pdfs/issue19389.pdf", + "md5": "419357cd829b067347c64b9ae838af4a", + "rounds": 1, + "type": "eq", + "forms": true + }, { "id": "issue7115", "file": "pdfs/issue7115.pdf",