Kevin Brown
Kevin Brown

Reputation: 8857

In Section 508, must a Link Annotation be the first thing inside a Link structure?

I am using the PAC PDF Accessibility Checker to analyze some PDFs. I am confused as to whether this is truly an error (as reported by this software) or whether the software possibly has a bug.

This deals with a Link structure. In examining a document which does not report an error. I see the structure reported by the tool is this:

enter image description here

There is a Link structure element which has inside of it a Link Annotation followed by a Span which contains the text "deductible".

Another PDF has this which is reported as an error that "Link Annotation is not nested inside a Link structure element":

enter image description here

The only real difference in these two is that the Span is before the Link Annotation but there is no question that the Link Annotation in the second example is nested inside the Link structure.

enter image description here

I believe this second structure is valid and should not be an error as reported but I am not sure. Question is ... does anyone know?

Must a Link Annotation be the first thing inside a Link structure or ?

Update

Using Adobe Tag viewer as suggested in one answer shows that it is clearly nested inside:

enter image description here

Upvotes: 1

Views: 2213

Answers (2)

Daniel F
Daniel F

Reputation: 529

I am implementing PDF/UA in an open source PDF renderer[1]. I was getting this exact error in PAC3 and like you thought it might be the fact that I was adding the object reference for the link annotation as the last kid of the link structure element instead of the first. So I refactored my code and made it the first kid. Still got the same error!

It turned out after re-reading part of the specification, that I was getting the generation of the number tree wrong. The number tree is used to get the structure element parent that corresponds with a content item - in this case a link annotation.

I can show you how to follow the annotation to its structure parent using the number tree. First, find your link annotation (search for /Link) (you can open the PDF with a text editor). It should look something like:

17 0 obj
<<
/Type /Annot
/Subtype /Link
/A 53 0 R
/Rect [0.0 113.774994 49.7625 125.99999]
/BS 54 0 R
/StructParent 2
>>

Note the /StructParent entry. This gives us a key in the number tree. Now find the number tree for the document (search for /Nums). It will look something like:

13 0 obj
<<
/Nums [0 [24 0 R 25 0 R 26 0 R 27 0 R 28 0 R 29 0 R 30 0 R 31 0 R 32 0 R 33 0 R
34 0 R]
 1 25 0 R 2 27 0 R 3 30 0 R 4 [35 0 R 36 0 R 37 0 R 38 0 R 39 0 R 40 0 R 41 0 R 42 0 R 43 0 R 44 0 R]
5 [45 0 R 46 0 R 47 0 R 48 0 R]
]
>>

Note that the entry next to 2, the structure parent for our link annotation is 27 0 R. So find 27 0 R in your document:

27 0 obj
<<
/Type /StructElem
/S /Link
/P 26 0 R
/Pg 8 0 R
/Alt (Go to Google!)
/K [3 69 0 R]
>>

Note that in this correct example it is your structure element with subtype /Link. If you could not follow this chain, or the object at the top of the chain is not a link structure element, it is highly likely your number tree is not being rendered correctly. In my case, when PAC was reporting the error, the object at the top of the tree was the link annotation itself. After changing that to its structure parent it worked fine.

[1] https://github.com/danfickle/openhtmltopdf/pull/315

Upvotes: 1

slugolicious
slugolicious

Reputation: 17475

Your screenshot is the link structure as shown by the PAC tool, right? What about the tag structure as shown by acrobat? If you can post the pdf file, I can take a look.

The Matterhorn Protocol, on page 10, has a section for errors with annotations (checkpoint 28). For error #11 it says "A link annotation is not nested within a Link tag."

If you look at the tags pane in acrobat, you should be able to see if your link annotation is contained within the link. Even though PAC might be good, you should look at the link structure in the original document, not from the tool.

You should have a <link> tag and then nested inside should be a "Link - OBJR" object. That's the annotation. If the "Link - OBJR" is outside the <link>, then that's the problem.

Here's a bad annotation:

bad annotation

Here's a good annotation:

enter image description here

To fix the bad annotation, you can just drag/drop "Link - OBJR" to the good location (under the <link>, before "PAC 1.3").

Upvotes: 0

Related Questions