From f113320bd5ce052fe250b5c647446f7d1c994ff0 Mon Sep 17 00:00:00 2001 From: Jonas Jenwald Date: Tue, 3 Oct 2023 20:06:19 +0200 Subject: [PATCH] Ensure that readonly TextWidget-annotations are rendered when forms are disabled (issue 17064) To reduced the risk of regressing something else, given that the issue only applies to a (for the default viewer) non-default configuration, this patch is purposely limited to only TextWidget-annotations in the display layer. --- src/display/annotation_layer.js | 5 +++++ test/pdfs/.gitignore | 1 + test/pdfs/issue17064_readonly.pdf | Bin 0 -> 2912 bytes test/test_manifest.json | 7 +++++++ 4 files changed, 13 insertions(+) create mode 100644 test/pdfs/issue17064_readonly.pdf diff --git a/src/display/annotation_layer.js b/src/display/annotation_layer.js index df8b730ec..3c17538e2 100644 --- a/src/display/annotation_layer.js +++ b/src/display/annotation_layer.js @@ -1159,6 +1159,7 @@ class TextWidgetAnnotationElement extends WidgetAnnotationElement { constructor(parameters) { const isRenderable = parameters.renderForms || + parameters.data.hasOwnCanvas || (!parameters.data.hasAppearance && !!parameters.data.fieldValue); super(parameters, { isRenderable }); } @@ -1497,6 +1498,10 @@ class TextWidgetAnnotationElement extends WidgetAnnotationElement { element.textContent = this.data.fieldValue; element.style.verticalAlign = "middle"; element.style.display = "table-cell"; + + if (this.data.hasOwnCanvas) { + element.hidden = true; + } } this._setTextStyle(element); diff --git a/test/pdfs/.gitignore b/test/pdfs/.gitignore index e33e13501..bcc279054 100644 --- a/test/pdfs/.gitignore +++ b/test/pdfs/.gitignore @@ -119,6 +119,7 @@ !issue7891_bc0.pdf !issue11242_reduced.pdf !issue16176.pdf +!issue17064_readonly.pdf !issue11279.pdf !issue11362.pdf !issue13325_reduced.pdf diff --git a/test/pdfs/issue17064_readonly.pdf b/test/pdfs/issue17064_readonly.pdf new file mode 100644 index 0000000000000000000000000000000000000000..caa6f739e7cc85ea88be26ca517c35c975af26a4 GIT binary patch literal 2912 zcmY!laBk>FdSS|qF390WzME6lg>PGi7jUK<`(8= zF6Q=Tbrx=&V4|n2@bYjfM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