3.22.  Permissions

Overview

If you expect your workflow to create copy protected PDF documents, you should test that. You can see the permissions using Adobe Reader®, but that is a poor test:

You can test permissions using the tag <hasPermission />. That tag has a suitable attribute for every possible permission:

<!-- Tag to test permissions: -->

<hasPermission toAllowScreenReaders=".."       (one of this attributes ...
               toAssembleDocument=".."         ...
               toCopyContent=".."              ...
               toExtractContent=".."           ...
               toFillInFields=".."             ...
               toModifyAnnotations=".."        ...
               toModifyContent=".."            ...
               toPrint=".."                    ...
               toPrintInDegradedQuality=".."   ... has to be used)
/>

<!-- The attributes can have the values 'YES' and 'NO' -->

The permissions 'extractContent' and 'copyContent' are identical.

Example

<testcase name="hasPermission_MultiplePermissions">
  <assertThat testDocument="permissions/itext-permission_default-without-password.pdf">
    <hasPermission toPrint="YES" 
                   toExtractContent="YES"
                   toModifyContent="NO"
    />
  </assertThat>
</testcase>