Adjust the dialog to your liking

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 JavaScript:

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 JavaScript 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 dialog shows all fields in the same order as they appear in the array. If certain keys are not present in the array, they are placed at the bottom of the dialog, 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 displays the variables in the specified order:

Example to download

(Earliest 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 JavaScript 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

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