Using variables with pdfToolbox in the cloud
Variables can be used in dynamic workflows to adjust parameters in a Profile. The Profile needs to be prepared so that it contains variables for dynamic parameters. Example: If a Profile downsamples images to a specified resolution it may use the variable "downsampleTo" for the target resolution with a default values of 250. In a dynamic workflow "downsampleTo" could then be set to "300" to adjust that value at run time.
But variables can be even more powerful and complex, it is eg. possible to create full Checks and Fixups on the fly. You will find all information about variables here: https://help.callassoftware.com/m/pdftoolbox/c/178329.
The sample Profile that is used by the pdfToolbox in the cloud demo client at callassoftware.io uses two variables "downsampleImages" and "downsampleTo". You may use this Profile as an example to see how to work with variables in the API.
The preflight_vars API provides information about all variables that are present in a Profile. The API requires to specify the URL for a Profile as shown on callassoftware.io. This will return three JSON files:
about.json provides general information about the Profile and the environment
definitions.json has all information about the variables: name, type, default value (optional) and an optional string that may be specified when the variable was defined providing information about the text to be used in a UI where a user can enter a new value
vars.json is a subset of definitions.json and provides only the name (key) and the default value. It uses a different syntax than definitions.json and this syntax has to be used to overwrite the values in the preflight API. Note that the vars object in the preflight API may specify variables that are not used in the Profile, they will then be ignored.