Chapter 13. Appendix

13.1.  Instantiation of PDF Documents

PDFUnit-XML reads a PDF documents using a file name or a URL. To distinguish between these two formats the attribute testIsURL or masterIsURL must be used. Here an example:

<comment>
  This test shows the usage of PDFUnit-XML when comparing two PDF
  documents loaded as a URL.
</comment>

<testcase name="compareDocuments_bothLoadedFromURL">
  <assertThat testDocument="./testdocuments/test.pdf"
              masterDocument="http://localhost/.../master/master.pdf"
              masterIsURL="YES"
  >
    ...
  </assertThat>
</testcase>

If documents are password protected, PDFUnit needs either the user password or the owner password to open the file. Both have to be defined in a separate attribute:

<testcase name="compareEncryptedTestAgainstEncryptedMaster">
  <assertThat testDocument="master/test.pdf"
              testPassword="secret-test"
              masterDocument="master/master.pdf"
              masterPassword="secret-master"
  >
    ...
  </assertThat>
</testcase>