Step by step - Learn how to use callas productscallas pdfToolbox Variables and JavaScriptUsing "trigger" values to adjust processing in a Process Plan (9.1)

Using "trigger" values to adjust processing in a Process Plan (9.1)

pdfToolbox 9.1 lets you access trigger values via a JavaScript object.

Trigger values are values that pdfToolbox reports back for objects that are identified by a check. The type of value corresponds to the check property that is used. E.g. for a check that finds all image objects with an image resolution below 300 ppi the trigger value reports the actual image resolution for each such image. For a check that finds objects that are close to TrimBox the trigger value has the actual distance between any such object and the TrimBox. The examples below use these two check properties and their trigger values to adjust processing:

  • List images with lowest resolution per page (uses trigger values)
    Uses the image resolution trigger values and prints on each page of a PDF file the lowest resolution that is used by an image on that page.
  • Use trigger values to calculate the width for page mirroring for bleed creation
    Uses the smallest distance between a text object and the TrimBox to define the width for mirroring page content. That makes sure that text objects do not show up in the bleed. It does this in a loop until there is no text closer than 3 mm to the mirrored page content.

The download contains kfpx Process Plans for the two examples as well as a simple demo file that can be used to try them out.

List images with lowest resolution per page (uses trigger values)

This Process Plan runs in a loop. The flow chart below gives an overview about how processing takes place in the 5 steps of the Process Plan and how that makes sure that each page is processed separately.

Use trigger values to calculate the width for page mirroring for bleed creation

The 6 steps of this Process Plans are:

  1. Set ArtBox to TrimBox
    This is done to "remember" the TrimBox since that has to be modified during processing.
  2. Check: Text is closer than 3 mm inside to TrimBox
    Finds all text objects that are so close to TrimBox that they would be mirrored by a bleed generation fixup.
  3. Mirror page into bleed with a width that text is not mirrored
    The width of bleed is defined by using a Script Variable "width_of_bleed". That first copies app.doc.result.checks[0].hits into a local Variable. It then generates an array variable "loc_triggerarray" into which all trigger values are written. Finally Math.min.apply is used to determine what is the smallest distance.
  4. Then the TrimBox is set to the new CropBox because that makes it easier to find out whether we already have generated enough bleed.
    After that processing goes back to the Check in step 2. If by then there is no text that is close to the (new) TrimBox (that at the same time is the CropBox) processing goes forth to step 5, otherwise the procedure above is repeated.
  5. Processing get to here only if there is no text closer than 3 mm to TrimBox. It sets the TrimBox back to the ArtBox which was the original TrimBox of the file after step 1.
  6. Finally the ArtBox that was only used temporarily has to be removed.

0 Comments

Send Your Comment

E-Mail me when someone replies to this comment