Cropping pages and making use of dynamic variables

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.

Open the Fixup dialog - choose Fixups in Tools menu or use Cmd-5 shortcut

The Fixup dialog will open where you can manage Fixups.

Fixup dialog

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.

"Show more options" menu

In the "Show more options" menu - the button with the cogwheel icon - choose the "Create New pdfToolbox Fixup..." menu item.

Create or edit a fixup

The pdfToolbox Create Fixup dialog lets you create new fixups.

Locate fixup for adjusting page geometry

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.

Configure the "Set page geometry boxes" fixup

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.

Defining dynamic variables for fields in a fixup

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.

Sample values for the dynamic variable definition dialog

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).

Fixup with dynamic variable fields

The four fields for left, right, top and bottom have been filled with dynamic variables.

New fixup now showing in the "Pages" group

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.

Specify dynamic variables upon execution of the fixup

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.

Save PDF with new cropping to disk

When carrying out a fixup like this page cropping fixup, pdfToolbox will ask the user where to save the modified PDF file.

Cropped page

As the fixup reduced the page size by 50mm at the bottom, the page is now cropped accordingly.

Successful execution of the page cropping fixup

In the "Results" view, pdfToolbox informs the user that the fixup has been executed successfully.



Did you like the video? Then you might want to have a look at related videos in the following playlist!

Back to overview