diff --git a/src/core/annotation.js b/src/core/annotation.js index b9bec56ffd077..50cd6ba096c2b 100644 --- a/src/core/annotation.js +++ b/src/core/annotation.js @@ -4274,10 +4274,15 @@ class FileAttachmentAnnotation extends MarkupAnnotation { constructor(params) { super(params); - const file = new FileSpec(params.dict.get("FS"), params.xref); + const { dict, xref } = params; + const file = new FileSpec(dict.get("FS"), xref); this.data.annotationType = AnnotationType.FILEATTACHMENT; this.data.file = file.serializable; + + const name = dict.get("Name"); + this.data.name = + name instanceof Name ? stringToPDFString(name.name) : "PushPin"; } } diff --git a/src/display/annotation_layer.js b/src/display/annotation_layer.js index 84ac665b17ed0..2d311fafbe61a 100644 --- a/src/display/annotation_layer.js +++ b/src/display/annotation_layer.js @@ -2509,7 +2509,20 @@ class FileAttachmentAnnotationElement extends AnnotationElement { render() { this.container.className = "fileAttachmentAnnotation"; - const trigger = document.createElement("div"); + let trigger; + if (this.data.hasAppearance) { + trigger = document.createElement("div"); + } else { + // Unfortunately it seems that it's not clearly specified exactly what + // names are actually valid, since Table 184 contains: + // Conforming readers shall provide predefined icon appearances for at + // least the following standard names: GraphPushPin, PaperclipTag. + // Additional names may be supported as well. Default value: PushPin. + trigger = document.createElement("img"); + trigger.src = `${this.imageResourcesPath}annotation-${ + /paperclip/i.test(this.data.name) ? "paperclip" : "pushpin" + }.svg`; + } trigger.className = "popupTriggerArea"; trigger.addEventListener("dblclick", this._download.bind(this)); diff --git a/test/pdfs/bug1230933.pdf.link b/test/pdfs/bug1230933.pdf.link new file mode 100644 index 0000000000000..4e929ed1be8ce --- /dev/null +++ b/test/pdfs/bug1230933.pdf.link @@ -0,0 +1 @@ +https://bugzilla.mozilla.org/attachment.cgi?id=8696459 diff --git a/test/test_manifest.json b/test/test_manifest.json index c096ba799b8e8..552d44d4be5ef 100644 --- a/test/test_manifest.json +++ b/test/test_manifest.json @@ -6064,6 +6064,14 @@ "type": "eq", "annotations": true }, + { "id": "bug1230933", + "file": "pdfs/bug1230933.pdf", + "md5": "d8e7dce9ce79aa5a6121b21be8935429", + "link": true, + "rounds": 1, + "type": "eq", + "annotations": true + }, { "id": "issue14117", "file": "pdfs/issue14117.pdf", "md5": "9b1c33ad2f59f4e723c258e863149abf", diff --git a/web/images/annotation-paperclip.svg b/web/images/annotation-paperclip.svg new file mode 100644 index 0000000000000..2bed2250aee5b --- /dev/null +++ b/web/images/annotation-paperclip.svg @@ -0,0 +1,6 @@ + + + + diff --git a/web/images/annotation-pushpin.svg b/web/images/annotation-pushpin.svg new file mode 100644 index 0000000000000..6e0896cf4ac0e --- /dev/null +++ b/web/images/annotation-pushpin.svg @@ -0,0 +1,7 @@ + + + + +