Adjust ask-at-runtime dialog

If a Profile, Check, Fixup or Process Plan contains variables, pdfToolbox Desktop displays the ask-at-runtime dialog before executing the profile to specify the variable values. As of pdfToolbox 15 it is possible to adjust the ask-at-runtime dialog using Java Script:

Adjust order of variables in ask-at-runtime dialog

By default, the ask-at-runtime dialog displays the variables in alphabetical order according to their variable keys. For example, if a preflight check has three variables specified with the following variable keys "width", "height", "unit", the ask-at-runtime dialog will display them in the following order:

To set the order of the variables in tha ask-at-runtime dialog the JavaScript object  app.context.dialog.order can be used. You can insert the Java Script object by clicking on the blue info icon next to the script editor (Insert JavaScript objects…).

app.context.dialog.order is an Array containing the variable keys. The first key in the array is asked first in the dialog. If a key is not named in the array, it is automatically placed at the end in alphabetical order:

app.context.dialog.order = ["width", "height", "unit"]

OR

app.context.dialog.order = ["width", "height"]
Click to copy

After setting the order with app.context.dialog.order , the ask-at-runtime dialog will display the variables in the specified order:

Example to download

(Erliest version with full support for “Check page size (var).kfpx” is pdfToolbox 15)

Hide / disable variables in ask-at-runtime dialog

By default, the ask-at-runtime dialog always shows all variables. In some cases, it is useful to hide or disable variables under certain conditions. For example, if you have a process plan where you can choose whether or not to create a bleed, the bleed-specific variables should only be adjustable/displayed if the "Create Bleed" Fixup is enabled.

To disable or hide Variables in an ask-at-runtime dialog the JavaScript object  app.context.dialog.state can be used. You can insert the Java Script object by clicking on the blue info icon next to the script editor (Insert JavaScript objects…):

//to disable variables

app.context.dialog.state = {
	"method": {
		"disable_if": {
			"create_bleed": false,
		}	
	},
	"bleed_width": {
		"disable_if": {
			"create_bleed": false,
		}	
	}
};


//to hide variables

app.context.dialog.state = {
	"method": {
		"hide_if": {
			"create_bleed": false,
		}	
	},
	"bleed_width": {
		"hide_if": {
			"create_bleed": false,
		}	
	}
};
Click to copy

If "disable_if" is used in app.context.dialog.state , the specified variables are grayed out and cannot be modified in the ask-at-runtime dialog unless the "Create Bleed" fixup is enabled:

If "hide_if" is used in app.context.dialog.state , the specified variables are not displayed in the ask-at-runtime dialog unless the "Create Bleed" fixup is enabled:

Example to download

(Erliest version with full support for “Generate bleed (var).kfpx” is pdfToolbox 15)