From e3faa40f0fabe52b3a2b82464775ec09c2840f03 Mon Sep 17 00:00:00 2001 From: Calixte Denizet Date: Mon, 10 Jun 2024 19:25:26 +0200 Subject: [PATCH] Don't display annotations with a PMD (barcode stuff) entry (bug 1899804) There's no specification for that (even if it's possible to have an idea from the xfa specs) so we just want to hide them in order to avoid to display something wrong. --- src/core/annotation.js | 12 ++++++++++-- test/pdfs/bug1899804.pdf.link | 1 + test/test_manifest.json | 17 +++++++++++++++++ 3 files changed, 28 insertions(+), 2 deletions(-) create mode 100644 test/pdfs/bug1899804.pdf.link diff --git a/src/core/annotation.js b/src/core/annotation.js index e6b292756..4e821b987 100644 --- a/src/core/annotation.js +++ b/src/core/annotation.js @@ -2681,11 +2681,19 @@ class TextWidgetAnnotation extends WidgetAnnotation { constructor(params) { super(params); + const { dict } = params; + + if (dict.has("PMD")) { + // It's used to display a barcode but it isn't specified so we just hide + // it to avoid any confusion. + this.flags |= AnnotationFlag.HIDDEN; + this.data.hidden = true; + warn("Barcodes are not supported"); + } + this.data.hasOwnCanvas = this.data.readOnly && !this.data.noHTML; this._hasText = true; - const dict = params.dict; - // The field value is always a string. if (typeof this.data.fieldValue !== "string") { this.data.fieldValue = ""; diff --git a/test/pdfs/bug1899804.pdf.link b/test/pdfs/bug1899804.pdf.link new file mode 100644 index 000000000..77ba32a0c --- /dev/null +++ b/test/pdfs/bug1899804.pdf.link @@ -0,0 +1 @@ +https://bugzilla.mozilla.org/attachment.cgi?id=9406437 diff --git a/test/test_manifest.json b/test/test_manifest.json index 1fb60b920..07ca39da9 100644 --- a/test/test_manifest.json +++ b/test/test_manifest.json @@ -10064,5 +10064,22 @@ "rounds": 1, "link": true, "type": "eq" + }, + { + "id": "bug1899804_print", + "file": "pdfs/bug1899804.pdf", + "md5": "53d82575d6d5d314404ede8970073e1b", + "rounds": 1, + "link": true, + "type": "eq", + "print": true + }, + { + "id": "bug1899804", + "file": "pdfs/bug1899804.pdf", + "md5": "53d82575d6d5d314404ede8970073e1b", + "rounds": 1, + "link": true, + "type": "eq" } ]