PDF Modules

The folder TBox XEngines->Pdf in the Standard subset contains a Module that performs specific tasks for the PDF Engine 3.0.

1:1 Compare

The Module 1:1 Compare allows you to compare two PDF files.

The PDF Engine 3.0 performs a visual comparison between the two files.

  • If the similarity between the two files is above a certain percentage, the TestCase passes.

  • If the similarity between the two files is below the expected value, the TestCase fails.

The Module has the following ModuleAttributes:

ModuleAttribute

Description

Reference PDF

Full path to the first PDF file, including the file name and extension.

Reference PDF Password

Password to open the first PDF file.

Target PDF

Full path to the second PDF file, including the file name and extension.

Target PDF Password

Password to open the second PDF file.

Accuracy [%]

Specify the minimum similarity in percent between the two files.

Text-only Comparison

Optionally, specify whether to only compare the text contents between the specified files. This means Tricentis Tosca ignores any graphical elements when performing the comparison.

If you are comparing only the text between extensive PDF files, this may improve the comparison performance.

Excluded Pages

Optionally, specify the pages that you want to exclude from the comparison.

To specify a page range, use a hyphen (-). To specify multiple pages or page ranges, use a semicolon (;).

Areas to Exclude

Optionally, specify areas in your PDF files that you want to exclude from the comparison. The following ModuleAttributes apply for each excluded area:

  • Area to Exclude > Dimensions contains the dimension coordinates respective to the excluded area. For information on how to get these dimensions, see "Exclude areas from the comparison".

  • Area to Exclude > Page(s) specifies in which pages of the document the excluded area is. To specify a page range, use a hyphen (-). To specify multiple pages or page ranges, use a semicolon (;).

Text to Exclude

Optionally, specify patterns of text that you wish to exclude from the comparison. You can use regular expressions to specify unique patterns, if needed. We recommend you use Regular Expressions 101 to verify your regular expressions.

The following ModuleAttributes apply for each excluded pattern:

In this example, you compare the file base.pdf to the file target.pdf.

You specify the password for each file.

You expect that the files should be at least 90 percent similar.

You exclude page 2 and pages 5 to 8 from the comparison.

Compare two PDF files

The comparison result shows that the files don't have the minimum similarity that you have specified.

Consequently, your TestCase fails.

Failed PDF comparison