Hide unsupported LinkAnnotations (issue 3897)

Rather than displaying links that does *nothing* when clicked, it probably makes more sense to simply not render them instead. Especially since it turns out that, at least at this point in time, this is *very* easy to both implement and test.

Fixes 3897.
This commit is contained in:
Jonas Jenwald 2017-09-02 10:06:44 +02:00
parent 9b14f8ea2a
commit 7115e136e4
4 changed files with 98 additions and 1 deletions

View File

@ -251,7 +251,9 @@ class AnnotationElement {
class LinkAnnotationElement extends AnnotationElement {
constructor(parameters) {
super(parameters, /* isRenderable = */ true);
let isRenderable = !!(parameters.data.url || parameters.data.dest ||
parameters.data.action);
super(parameters, isRenderable);
}
/**

View File

@ -89,6 +89,7 @@
!simpletype3font.pdf
!sizes.pdf
!javauninstall-7r.pdf
!file_url_link.pdf
!multiple-filters-length-zero.pdf
!non-embedded-NuptialScript.pdf
!issue3205r.pdf

View File

@ -0,0 +1,85 @@
%PDF-1.7
%âãÏÓ
1 0 obj
<<
/Pages 2 0 R
/Type /Catalog
>>
endobj
2 0 obj
<<
/Kids [3 0 R]
/Count 1
/Type /Pages
>>
endobj
3 0 obj
<<
/Parent 2 0 R
/Annots [4 0 R]
/MediaBox [0 0 200 50]
/Resources
<<
/Font
<<
/F1 5 0 R
>>
>>
/Contents 6 0 R
/Type /Page
>>
endobj
4 0 obj
<<
/Border [0 0 1]
/Subtype /Link
/C [0 1 0]
/A
<<
/URI (file://path/to/local/file.pdf)
/Type /Action
/S /URI
>>
/Type /Annot
/Rect [5 10 180 40]
>>
endobj
5 0 obj
<<
/BaseFont /Times-Roman
/Subtype /Type1
/Encoding /WinAnsiEncoding
/Type /Font
>>
endobj
6 0 obj
<<
/Length 62
>>
stream
1 0 0 rg
BT
10 20 TD
/F1 20 Tf
(path/to/local/file.pdf) Tj
ET
endstream
endobj xref
0 7
0000000000 65535 f
0000000015 00000 n
0000000066 00000 n
0000000125 00000 n
0000000270 00000 n
0000000437 00000 n
0000000538 00000 n
trailer
<<
/Root 1 0 R
/Size 7
>>
startxref
652
%%EOF

View File

@ -623,6 +623,15 @@
"annotations": true,
"about": "Annotation with Rect array containing indirect objects."
},
{ "id": "file_url_link",
"file": "pdfs/file_url_link.pdf",
"md5": "b0253c96c38d43bc49259bbf36db938a",
"link": false,
"rounds": 1,
"type": "eq",
"annotations": true,
"about": "Annotation with (unsupported) file:// URL."
},
{ "id": "issue4934",
"file": "pdfs/issue4934.pdf",
"md5": "6099da44f677702ae65a648b51a2226d",