Sometimes it is necessary to check against different values each time a check or fixup is carried out. As pdfToolbox offers dynamic checks and fixups – through the use of dynamic variables – there is no need to create separate checks and fixups each time the target values change. Instead the target value or values can be entered each time the check, fixup or profile is executed.
This tutorial explains the use of dynamic variables for setting up a check. In addition, the same dynamic variable mechanism can be used for fixups and profiles. Profiles may contain several checks or fixups making use of dynamic variables. As variables are identified by their internal name, they can be re-used across a single check or fixup. For any given variable name, pdfToolbox will only ask once per execution for the value to be used.
Select the menu entry "Checks" under the "Tools" menu to open the "Checks" panel.
In the upper right of the pdfToolbox "Checks" panel is the "Tools" button – click on it and then select "Create New pdfToolbox 4 Check..."
See next step for instructions about how to fill out the "Variables" dialog.
In the "Variables" dialog, enter the following values:
Upon closing the "Variable" dialog, the variable definition will be inserted in the "Number:" field as a placeholder token.
The same placeholder token can be used in more than one place – for example in the name field. Even in cases where a variable occurs more than once in a check (or fixup or profile), the user has to enter it only once when executing it.
By putting the same dynamic variable inside the name for the check will retrieve the value from the placeholder token for displaying the name (either the default value for display in the list of checks, or in the results information after running a check – in that case it will be the value entered by the user).
In order to reuse the variable in a different field, just select and copy it and paste it at the end of the name field – in this example "Image res is below" will then be displayed as "Image res is below 300" (or if you add " ppi" after the placeholder token, it will say "Image res below 300 ppi").
Once done, click "OK" and close the dialog, saving the new check.
Once having clicked on the "Analyze" button, the check will be initiated, first asking the user to enter a value for the dynamic variable.
As can be seen, it is very easy to adjust the check each time as needed.
The use of dynamic variables is not limited to just one variable in a check (or fixup or profile). In essence, variables can be used for virtually any text edit field in dialogs that let you configure checks, fixups or profiles.
We intend to be able to have a check that finds images whose resolution is within a certain range. As a consequence, we need two parts for the check, one for the lower bound, the other one for the upper bound.
Prepare the two parts of the check such that one is set to search for values "greater than" the threshold value (1), and the other one for values "less than" (2). Then click on the "dynamic variable button" next to the two "Number:" fields (3 and 4).
By copying and pasting the respective placeholder tokens, you can change the string "Image res is between ... and ..." into a more intuitive "Image res is between 72 and 300", where the numbers 72 and 300 are taken from the dynamic variable setup, and where different numbers may be displayed in the results after running the check, if the user entered different minimum and maximum values.
Under certain circumstances, it may happen that a warning is shown, claiming that two properties contradict each other. Just click "Continue" to proceed.
Once the creation of the new check is completed, it will show up in the "Checks" panel (1). Click on "Analyze" to run the new check on the current PDF document (2).
In the example, images will be detected which have a resolution between 70 ppi and 150 ppi.
The dynamic check will find images between 70 ppi and 150 ppi but ignore images below 70 ppi or above 150 ppi.
Did you like the video? Then you might want to have a look at related videos in the following playlist!