Negating Check results
pdfToolbox 10 introduces two new methods for negating Check results:
- by inverting a Check (in a boolean way)
- by adding a condition that fires if the number of hits in the other conditions is zero
In older versions it was possible to use operators like "does not contain", "unequal to" or "is not true". All three variants of negation have different results.
The easiest way to understand the differences and use cases is to use an example. We will use a PDF that uses two spot colors and a process color.
The attached Profile uses Checks for each of the three possible ways to configure negation.
Negation by operators "does not contain", "unequal to" or "is not true"
The Profile has a Check "Spot color name equal to Orange" and a Check "Spot color name unequal to Orange". The first finds one item in the sample PDF, the second line of text, the second Check finds the first line.
The background to that is that the Property "Spot color name" that has been used only checks objects that are using spot color. Most of the Properties in pdfToolbox internally have such limitations, e.g. the Property "Image resolution" will only find images. Usually these limits work intuitively right, but sometimes that is not intended - and that is when the next option comes into play.
Negation by "Invert check result"
In the left column of the Check editor is a checkbox "Invert check result".
In the sample Profile it is used in "Inverted: Spot color name unequal to Orange". This Check finds now two lines of text: The one that uses spot color Varnish and in addition the one that uses process color.
For the properties:
- “Include other check” and
- any Sifter properties (Context aware object detection)
the option “invert check result” is not possible and therefore grayed out.If you want to add one of these properties to a Check where the “Invert check result” checkbox is already activated, the checkbox will be automatically disabled and grayed out. The reason for this is that the result would otherwise be undefined.
Negation by adding a condition that fires if the number of hits in the other conditions is zero
The Profile also contains Checks "Number of hits equal 0 for Spot color name equal to Orange" and "Number of hits equal 0 for Spot color name equal to Violet". The additional Property "Number of hits in this check" that is used in both of them is not new in pdfToolbox 10, new is that is can now also be combined with "equal to" 0 (zero).
This property always works on a page basis, this means when used, the scope of the Check are no more objects on the page but the page itself. So it converts the other Property in the Check, e.g. "Spot color name" into a page based Check that fires if the number of hits on the page matches what has been defined in "Number of hits in this check".
In the sample only the Check "Number of hits equal 0 for Spot color name equal to Violet" will generate a hit since that spot color is not used on the page.
pdfToolbox 10 also introduces a new Property "Number of hits in this check in document" that counts hits not on page level but on document level. So it would convert the other conditions in the Check (whether they are designed to work for objects or pages) into document level Properties.