Chapter 4. Comparing a Test PDF with a Master

4.1.  Overview

Many tests follow the principle of comparing a newly created test document with a PDF document which has already been validated. Such tests are useful if the process that creates the PDF has to be changed, but the output should be the same.

Many properties of a PDF document that can be tested individually can also be tested as a comparison with a master PDF.

Initialization

A master document is declared using the attribute masterDocument:

<testcase name="testInstantiation_NotEncryptedMaster">
  <assertThat testDocument="test/test.pdf"
              testPassword="owner-password"         1
              masterDocument="master/master.pdf"    2
  >
  </assertThat>
</testcase>

1

If the test document is password protected, the second parameter is needed.

2

If the master document is not password protected, only the filename is needed. Otherwise a password has be given with the attribute masterPassword.

Passwords are only used to open the documents. They do not influence the tests.

Overview

The following list gives a complete overview of all tests which compare two PDF files. Links after each tag refer to the chapter which describes it in detail. The chapters are sorted alphabetically. The last chapter 4.20: “Further Comparisons” collects all the functions which are not described in other chapters.

<!-- Tags to compare two PDF documents: -->

<areBothForFastWebView />          4.20: “Further Comparisons” 
<haveSameActions />                4.3: “Comparing Actions” 
<haveSameAppearance />             4.12: “Comparing Layout as Rendered Pages” 
<haveSameAuthor />                 4.7: “Comparing Document Properties” 
<haveSameBookmarks />              4.5: “Comparing Bookmarks” 
<haveSameCreationDate />           4.6: “Comparing Date Values” 
<haveSameCreator />                4.7: “Comparing Document Properties” 
<haveSameEmbeddedFiles />          4.4: “Comparing Attachments” 
<haveSameFields />                 4.2: “Comparing Form Fields” 
<haveSameFonts />                  4.8: “Comparing Fonts” 
<haveSameFormat />                 4.9: “Comparing Format” 
<haveSameImages />                 4.10: “Comparing Images” 
<haveSameJavaScript />             4.20: “Further Comparisons” 
<haveSameKeywords />               4.20: “Further Comparisons” 
<haveSameLanguage />               4.20: “Further Comparisons” 
<haveSameLayerNames />             4.20: “Further Comparisons” 
<haveSameModificationDate />       4.6: “Comparing Date Values” 
<haveSameText />                4.17: “Comparing Text” 

...  continued
... continuation:

<haveSameNumberOfActions />        4.3: “Comparing Actions” 
<haveSameNumberOfBookmarks />      4.5: “Comparing Bookmarks” 
<haveSameNumberOfEmbeddedFiles />  4.4: “Comparing Attachments” 
<haveSameNumberOfFields />         4.2: “Comparing Form Fields” 
<haveSameNumberOfFonts />          4.8: “Comparing Fonts” 
<haveSameNumberOfImages />         4.10: “Comparing Images” 
<haveSameNumberOfLayers />         4.15: “Comparing Quantities of PDF Elements” 
<haveSameNumberOfPages />          4.15: “Comparing Quantities of PDF Elements” 
<haveSameNumberOfTaggingInfo />    4.15: “Comparing Quantities of PDF Elements” 
<haveSamePermission />             4.14: “Comparing Permissions” 
<haveSamePermissions />            4.14: “Comparing Permissions” 
<haveSameProducer />               4.7: “Comparing Document Properties” 
<haveSameProperties />             4.7: “Comparing Document Properties” 
<haveSameProperty />               4.7: “Comparing Document Properties” 
<haveSameSignatureNames />         4.16: “Comparing Signature Names” 
<haveSameSubject />                4.7: “Comparing Document Properties” 
<haveSameTaggingInfo />            4.20: “Further Comparisons” 
<haveSameTitle />                  4.7: “Comparing Document Properties” 
<haveSameTrappingInfo />           4.20: “Further Comparisons” 
<haveSameXFAData />                4.18: “Comparing XFA Data” 
<haveSameXMPData />                4.19: “Comparing XMP Data” 

...  (end of list)