Chapter 5. Tests with Multiple Documents

A test with more than one PDF document

The following code shows how to use multiple documents in one test. The test stops at the first detected error.

<testcase name="textInMultipleDocuments">
  <assertThatEachDocument>
    <pdf name="multipleDocuments/document_en.pdf" />
    <pdf name="multipleDocuments/document_es.pdf" />
    <pdf name="multipleDocuments/document_de.pdf" />
    <hasText on="FIRST_PAGE" >
      <containing>28.09.2014</containing>
      <containing>XX-123</containing>
    </hasText>
  </assertThatEachDocument>
</testcase>

The test documents can als be of type URL:

<testcase name="textInMultipleDocuments_AsURL">
  <assertThatEachDocument>
    <pdf name="http://localhost/.../document_en.pdf" isURL="YES" />
    <pdf name="http://localhost/.../document_es.pdf" isURL="YES" />
    <pdf name="http://localhost/.../document_de.pdf" isURL="YES" />
    <hasText on="FIRST_PAGE" >
      <containing>28.09.2014</containing>
      <containing>XX-123</containing>
    </hasText>
  </assertThatEachDocument>
</testcase>

For such tests almost all test tags are available, which exist for tests with a single PDF document. The following list shows the available tags. Links refer to the description of each tag.

<!-- Tags to validate a set of PDF documents:  -->

<containsImage />                3.13: “Images in PDF Documents” 

<hasAuthor />                    3.7: “Document Properties” 
<hasBookmark />                  3.4: “Bookmarks and Named Destinations” 
<hasBookmarks />                 3.4: “Bookmarks and Named Destinations” 
<hasCreationDate />              3.6: “Dates” 
<hasCreationDateAfter />         3.6: “Dates” 
<hasCreationDateBefore />        3.6: “Dates” 
<hasCreator />                   3.6: “Dates” 

<hasEmbeddedFile />              3.3: “Attachments” 
<hasEmbeddedFileContent />       3.3: “Attachments” 
<hasEncryptionLength />          3.21: “Passwords” 
<hasField />                     3.10: “Form Fields” 
<hasFields />                    3.10: “Form Fields” 
<hasFont />                      3.9: “Fonts” 
<hasFonts />                     3.9: “Fonts” 
<hasFormat />                    3.12: “Format” 
<hasJavaScript />                3.14: “JavaScript” 
<hasKeywords />                  3.7: “Document Properties” 
<hasLayer />                     3.16: “Layers” 
<hasLayers />                    3.16: “Layers” 
<hasLessPages />                 3.20: “Page Numbers as Objectives” 
<hasLocale />                    3.15: “Language” 
<hasModificationDate />          3.6: “Dates” 
<hasModificationDateAfter />     3.6: “Dates” 
<hasModificationDateBefore />    3.6: “Dates” 
<hasMorePages />                 3.20: “Page Numbers as Objectives” 

...  continued
... continuation:

<hasNoAuthor />                  3.7: “Document Properties” 
<hasNoCreationDate />            3.6: “Dates” 
<hasNoCreator />                 3.7: “Document Properties” 
<hasNoKeywords />                3.7: “Document Properties” 
<hasNoLocale />                  3.15: “Language” 
<hasNoModificationDate />        3.6: “Dates” 
<hasNoProducer />                3.7: “Document Properties” 
<hasNoProperty />                3.7: “Document Properties” 
<hasNoSubject />                 3.7: “Document Properties” 
<hasNoText />                    3.25: “Text” 
<hasNoTitle />                   3.7: “Document Properties” 
<hasNoXFAData />                 3.30: “XFA Data” 
<hasNoXMPData />                 3.31: “XMP Data” 

<hasOwnerPassword />             3.21: “Passwords” 
<hasPermission />                3.22: “Permissions” 
<hasProducer />                  3.7: “Document Properties” 
<hasProperty />                  3.7: “Document Properties” 
<hasSignature />                 3.23: “Signatures and Certificates” 
<hasSignatures />                3.23: “Signatures and Certificates” 
<hasSignedSignatureFields />     3.23: “Signatures and Certificates” 
<hasSubject />                   3.7: “Document Properties” 
<hasText />                      3.25: “Text” 
<hasTitle />                     3.7: “Document Properties” 
<hasTrappingInfo />              3.28: “Trapping Info” 
<hasUnsignedSignatureFields />   3.23: “Signatures and Certificates” 
<hasVersion />                   3.29: “Version Info” 
<hasXFAData />                   3.30: “XFA Data” 
<hasXMPData />                   3.31: “XMP Data” 

<isCertified />                  3.5: “Certified PDF” 
<isLinearizedForFastWebView />   3.8: “Fast Web View” 
<isSigned />                     3.23: “Signatures and Certificates” 
<isTagged />                     3.24: “Tagged Documents” 

...  (end of list)

If you are looking for more tests please send your request to info[at]pdfunit.com.