Using JavaScript in an (apply to) filter

Beginning with pdfToolbox 13, you may use JavaScript code for a filter, before it was only possible to use Checks as a (static) resource. This makes creating Fixups even more dynamic.

We are using an example 'Arbitrary JavaScript controlled Fixup' (also attached below) where some text is put at the center of page 1. We want to create a JavaScript structure that replaces the Check that is in the resource "Page 1".

In order to do so: 

  1. We create some delimiter (comment) at the top of the JavaScript code
  2. Place the cursor above it 
  3. Use the blue 'i' icon and select "Insert configured Check".

Then we pick the preconfigured Check (or we could use "Insert base Check..." to create one).

This inserts a JavaScript structure that represents the Check.

We then assign this new structure to a variable, e.g. "applyToCheck":

Then we scroll down to the Fixup structure and replace "Page 1" with the name of this variable.

And then the Fixup can be used.

Of course the above makes more sense if the structure is created dynamically.