pdfToolbox offers a very flexible fixup to adjust the crop box, as well as other geometry aspects, of pages in a PDF file. This lesson explains how to use the fixup, and how to create a fixup with dynamic variables, so that the same pre-configured fixup can be used for different cropping values each time.
The Fixup dialog will open where you can manage Fixups.
The Fixup dialog contains a list of all existing fixups. Due to the large number of pre-configured fixups the "Find" feature in the upper right is very useful when locating a specific fixup, or when searching for the fixups available for a certain type of modification.
In the "Show more options" menu - the button with the cogwheel icon - choose the "Create New pdfToolbox Fixup..." menu item.
The pdfToolbox Create Fixup dialog lets you create new fixups.
As the number of available fixup features is quite long, enter "box" in the search field to display only those fixups that deal with the page geometry boxes in a PDF.
Select the entry called "Set page geometry boxes" - the available properties, like which geometry aspect to adjust, and by how much - will appear. The orange colored icons to the right of the text editing fields serve a very important purpose - by using them a field can be filled with a place holder, that will trigger a dialog at run time, so that a user can enter different values each time the fixup is used, without having to change its configuration.
When clicking on an orange 'dynamic variable' icon, a dialog will appear that lets you fill in the internal name of the variable (we recommend to use upper case only, without spaces or special characters in the variable name), the label or explanation shown later on when the fixup is executed, and a default value, which is used to pre-populate the field later on.
For the first field in the fixup, the variable name "LEFT" is chosen, the text "Left inset:" will inform the user later on what kind of value is established here, and the default value is set to 0 (zero).
The four fields for left, right, top and bottom have been filled with dynamic variables.
Once the configuration of the fixup is completed, clicking OK in the fixup configuration dialog will save the new fixup, and it will show up in the list of fixups in the "Fixups" dialog.
When a user clicks on "Fix" with the new fixup selected, a dialog will appear asking for values for the four dynamic variables. In the example, only the "Bottom inset:" field is changed from zero to -50 (as we have defined millimeters as the unit for this fixup, this implies that the cropping is changed by 50mm).
Important: In order to make the page size smaller, enter negative values. Entering positive values will make the page sizer larger.
When carrying out a fixup like this page cropping fixup, pdfToolbox will ask the user where to save the modified PDF file.
As the fixup reduced the page size by 50mm at the bottom, the page is now cropped accordingly.
In the "Results" view, pdfToolbox informs the user that the fixup has been executed successfully.