What does "arbitrary JavaScript controlled" mean?

pdfToolbox allows the creation of a wide array of checks and fixups. They all feature custom UI with properties that modify the behavior of the check or fixup. When that is insufficient, almost all properties accept using variables, which allow modifying their values on the fly, using data coming into pdfToolbox from the outside, or using JavaScript to calculate the properties.

Usually, this provides all the flexibility that is required, but sometimes you want to go even further than this. That's the time the Arbitrary JavaScript Controlled Checks or Fixups are necessary. 

What are they?

The "Arbitrary JavaScript Controlled Checks" is a condition. It lives in the list of conditions, specifically in the "Document" group. As a condition, it can be added to any preflight check you are creating or editing.

The "Arbitrary JavaScript Controlled Fixups" is a type of fixup. It also lives in the Document group and can be selected when you create a new fixup.

Arbitrary

The "Arbitrary" in the name refers to the fact that this condition, or this fixup type, can be used to create any condition, check, or fixup on the fly. And not just a single check or fixup either; one of these can effectively define a whole list of conditions, checks, or fixups. This is important, as it allows creating as many conditions, checks, or fixups as needed, even without knowing exactly what (or how many) you'll need beforehand.

JavaScript controlled

The "JavaScript controlled" part in the name of this condition and fixup type refers to the fact that they don't use a predefined user interface but rather use JavaScript. 

Both look very similar to the above. Instead of checkboxes, menus, and edit fields, there is a JavaScript editor. The JavaScript code in this editor needs to result in the correct type of JavaScript object. When done correctly, pdfToolbox uses these objects and creates conditions, checks, or fixups from them.

Where to go from here?

Because this functionality uses JavaScript, and in a relatively complex way, intertwined with a lot of pdfToolbox technology, it is not the easiest to master. The following articles introduce Arbitrary JavaScript Controlled Checks first and then do the same for Fixups.

Through building examples, you'll come to understand the JavaScript objects to use, but you'll especially learn how to know as little as possible and let pdfToolbox do the work for you.