Adding grommets using a Fixup
Besides using the Switchboard action, it is also possible to use a Fixup instead.
To reflect the 2 possible ways of positioning grommets ("by distance" or "by number"), several Variables have to be defined to ensure a proper placement.
Used variables
Key of the Variable |
Value |
Description |
---|---|---|
grommet_template |
Path to a grommet file (as PDF, JPEG, PNG) |
Defines the path to the grommet to be used. Must be an absolute path. |
measurement_unit |
cm, mm, in, pt Default: mm |
Defines the unit used for all defined distances of other Variables. |
distance_bottom |
Number Default: 20 |
Distance from TrimBox - bottom |
distance_left |
Number Default: 20 |
Distance from TrimBox - left |
distance_right |
Number Default: 20 |
Distance from TrimBox - right |
distance_top |
Number Default: 20 |
Distance from TrimBox - top |
count_horizontal |
Number Default: 10 |
Grommet count for "Grommets by number" (horizontal) Must be set to number of requested grommets or to "-1" if "spacing_..."-Variables are used |
count_vertical |
Number Default: 10 |
Grommet count for "Grommets by number" (vertical) Must be set to number of requested grommets or to "-1" if "spacing_..."-Variables are used |
spacing_horizontal |
Number Default: -1 (inactive) |
Spacing between Grommets for "Grommets by Distance" (horizontal) Must be set to number of requested grommets (or to "-1" if "count_..."-Variables are used) |
spacing_vertical |
Number Default: -1 (inactive) |
Spacing between Grommets for "Grommets by Distance" (vertical) Must be set to number of requested grommets (or to "-1" if "count_..."-Variables are used) |
As already mentioned in the table above, the usage of the Variables "count_..." or "spacing_..." will decide if the grommets are placed "by number" or "by distance".
As the default values for the "spacing_..." are set to "-1", they are not active unless Variables are explicitly defined. If they are used, the "count_..."-Variables must be "switched off" by setting their value to "-1".
It is of course possible to combine e.g. the "count_vertical" with the "spacing_horizontal" Variable, but please remember to set the corresponding variable to "-1" if a "spacing_"-Variable is used.
Sample CLI calls
To place e.g. 15 grommets horizontally and 12 vertically, the respective CLI call would look like:
pdfToolbox <kfpx> <PDF> --setvariable=grommet_template:<Path to grommet PDF> --setvariable=count_horizontal:15 --setvariable=count_vertical:12
For placing grommets by distance (approx. 480mm on the vertical and horizontal edge) , the "spacing_..."-Variables have to be set and (as described above) the "count_..."-Variables must be set to "-1":
pdfToolbox <kfpx> <PDF> --setvariable=grommet_template:<Path to grommet PDF> --setvariable=count_horizontal:-1 --setvariable=count_vertical:-1 --setvariable=spacing_horizontal:480 --setvariable=spacing_vertical:480
Please note: As the distance between the grommets is adjusted to the total length of the edge, the effective distance used in the resulting PDF may differ from the defined input values.