3.24.  Tagged Documents

Overview

The PDF standard ISO 32000-1:2008 says in chapter 14.8.1 A Tagged PDF document shall also contain a mark information dictionary (see Table 321) with a value of true for the Marked entry. (Cited from: http://www.adobe.com/content/dam/Adobe/en/devnet/acrobat/pdfs/PDF32000_2008.pdf.)

Although the standard says shall, PDFUnit looks in a PDF document for a dictionary with the name /MarkInfo. And if that dictionary contains the key /Marked with the value true, PDFUnit identifies the PDF document as tagged.

Following tags are available:

<!-- Tag to verify tagging information: -->

<isTagged />

<!-- Inner tag of <isTagged />: -->
<with key=".."       (required)
      andValue=".."  (optional)
/>  

Examples

The simplest test checks whether a document is tagged.

<testcase name="isTagged">
  <assertThat testDocument="tagged/itext-created_tagged.pdf">
    <isTagged />
  </assertThat>
</testcase>

Further tests verify the existence of a particular tag.

<testcase name="isTagged_WithKey">
  <assertThat testDocument="tagged/xdp_2.0.pdf">
    <isTagged>
      <with key="LetterspaceFlags" />  
    </isTagged>
  </assertThat>
</testcase>

And finally you can verify values of tags:

<testcase name="isTaggedWithKeyValue_MultipleInvocations">
  <assertThat testDocument="tagged/xdp_2.0.pdf">
    <isTagged>
      <with key="Marked"           andValue="true" />  
      <with key="LetterspaceFlags" andValue="0" />  
    </isTagged>
  </assertThat>
</testcase>