Variables and JavaScript: Variables in general

Variables can be assigned to everything

Variables can be assigned to everything

Variables can be defined in several places throughout the Profile/Checks/Fixups editor. Variables may be assigned to virtually every control including the severity for a check:

  • Text input fields
  • Checkboxes
  • Pop Up fields
  • Severities
  • On/Off switch in order to enable/disable Checks or Fixups in a Profile

Assign a variable

Assign a variable

When you click on a variable icon in the pdfToolbox Profiles/Checks/Fixups editor, you will see a list of all variables that are present in the system. Variables that are used in the current context (e.g. the current Profile) appear at the top. You may pick any of the existing variables, create a new one or edit one that is already assigned.

Deleting a variable is currently only possible in the Library Manager and only if the variable is not used. Whether or not a variable is used can also be seen there.

Variable Editor: Creating a new variable

You have to define a key for the variable, an optional Name that will be used in a pdfToolbox Desktop dialogue and the default value. If you use a Simple value Variable these are the most important ones, but you may in addition define Constraints (this is explained in a later step in this chapter). For a Script Variable you may use the help that is available via the info button, the JavaScript help has the same content as the respective chapter in this manual.

Variable Editor: Creating a new variable

For Checkboxes and Pop ups you can use the info button to pick one of the possible default values

For Checkboxes and Pop ups you can use the info button to pick one of the possible default values

Constraints

Constraints

Constraints can be defined by using the "Limit input values to specific values" checkbox in the variable editor. In this context the expected value type of the variable is important which is indicated above of input field for the default value.

You may in addition specify:

  • whether a Browse button shows up when executed in pdfToolbox Desktop that allows a user to pick a file from the system (e.g. to load an ICC profile)
  • whether the entries in Values are used as list, in which case a Pop up would show up in the dialogue of pdfToolbox Desktop or as a range. In the latter case invalid values that are out of range will be indicated by a red cross.

Constraints - Range specifics

Constraints - Range specifics

When you are using the Range option, two values will define a range and a single value defines a single allowed value. In this example 100-300 and 500 are permitted values (which usually does not make sense).

Constraints for Pop up fields

Constraints for Pop up fields

You may again use the info button in order to pick possible values for the Pop up. In this example this is done for a severity, but it works in the same way for other Pop up fields.

Profile Script Scope

It is possible to set a value for a variable in other script variables by means of Javascript. And this can and will usually be done on Profile level. In turn it only makes sense to use Script values at this place. Please go to the pdfToolbox Javascript in variables documentation for further information.

Variables in Processplans

It is possible to define a variable as a step in a Process Plan. This will work similar to a Variable on Profile level in does only makes sense and work for Script variables.

The "Ask at runtime" in pdfToolbox Desktop

The "Ask at runtime" in pdfToolbox Desktop

In pdfToolbox Desktop a dialogue shows up, when a Profile/Check/Fixup is executed that has editable variables, i.e. variables that are not calculated by means of Scripts. If you want to see the dialogue for a Profile/Check/Fixup that only has calculated variables you will have to add one additional variable that is not calculated.

Script variables are hidden as long as no evaluation errors had occurred. If an evaluation error has occurred the OK button is disabled. Details can be displayed by clicking the “Inspect variable” checkbox. It allows you to analyze the structure of all variables in the given context.

0 Comments

Send Your Comment

E-Mail me when someone replies to this comment