4.14.  Comparing Permissions

PDFUnit can compare the permissions of two PDF documents. The following example compares all permissions:

<testcase name="haveSamePermissions">
  <assertThat testDocument="test/test.pdf"
              masterDocument="master/master.pdf"
  >
    <haveSamePermissions />
  </assertThat>
</testcase>

If you want to compare a single permission you can use the attribute permission=".." with predefined constants:

<testcase name="haveSamePermissions_MultiplePermissions">
  <assertThat testDocument="test/test.pdf"
              masterDocument="master/master.pdf"
  >
    <haveSamePermission permission="ALLOW_EXTRACT_CONTENT" />
    <haveSamePermission permission="ALLOW_COPY" />
    <haveSamePermission permission="ALLOW_MODIFY_CONTENT" />
  </assertThat>
</testcase>

The following constants are available:

<!-- Available permissions: -->

permission="ALLOW_ASSEMBLE_DOCUMENTS"
permission="ALLOW_COPY"
permission="ALLOW_DEGRADED_PRINTING"
permission="ALLOW_EXTRACT_CONTENT"     1
permission="ALLOW_FILL_IN"
permission="ALLOW_MODIFY_ANNOTATIONS"
permission="ALLOW_MODIFY_CONTENT"
permission="ALLOW_PRINTING"
permission="ALLOW_SCREENREADERS"       2 

1 2

The permissions ALLOW_EXTRACT_CONTENT and ALLOW_SCREENREADERS are equivalent.