Using Quick Check as a step in a Process Plan

When creating or editing a Process Plan, it is possible to insert a Quick Check step in the Process Plan.

For the purpose of this article, a new Process Plan is created:

After entering a suitable name for the new Process Plan, select "Quick Check" from the "Sequence" list and click on the "Add" button in that list entry:

A new "Quick Check" step gets inserted as the first item in the list of Process Plan steps.

  1. In order to configure what the "Quick Check" step is to provide as a result, either a suitable Quick Check-JavaScript variable has to be chosen in the "Name" popup list,
  2. or a new Quick Check-JavaScript variable has to be created using the "+" icon.

When creating a new Quick Check-JavaScript variable, the Edit Quick Check window is opened.

Suitable values have to be entered for "Key" (by which the variable can be referenced in the app.vars object), the "Label" (shown in the user interface when displaying a reference to the variable) and the actual "Script".

In the example shown below, a very simple configuration is used that requests that the TrimBox for all pages is retrieved.

Click OK to save this Quick Check-JavaScript variable, and click OK again to save the new Process Plan.

Whenever this Process Plan is executed, the TrimBox of all pages gets stored in the app.vars object under my_quick_check_example.

Obviously, in this simple form the Process Plan is not very useful. The next part of the article shows a slightly extended variant of this Process Plan, that actually makes some interesting use of the information retrieved by the Quick Check step.

How to use information retrieved by a Quick Check step in a Process Plan

In order to try out the Process Plan presented below, please download it here:

After importing the downloaded "Quick_Check_example.kfpx"  file and importing it into pdfToolbox Desktop, it should show up as can be seen below:

In order to explore how this Process Plan has been constructed, click on the "Edit..." button next to the "Quick Check example" entry.

The "Edit Process Plan" dialog will open. It contains two steps:

  1. Quick Check step using a variable named "quick_check_sample_JavaScript_variable" that collects information from the current PDF
  2. Fixup step "Put file name + file path on upper left of all pages" that picks up the collected information and uses it to place text on each page of the current PDF

In order to have a look at the way the JavaScript variable has been set up,

  1. click on the Edit button to the right of the "Name" popup.

 

The "Edit Variable" window will open, revealing the setup of the variable "quick_check_sample_JavaScript_variable".

The relevant part of the configuration are these two lines:

            "$.aggregated.file.name: true ",
            "$.aggregated.file.filepath: true ",

which request that Quick Check retrieves information about the file name and the file path of the current PDF. For a detailed description of the configuration set up please check out the article Quick Check configuration syntax.

Close the "Edit Variable" window, and thus go back to the Edit window for the Process Plan.

  1. Click on the Edit icon to the right of the Name entry for the Fixup step.

The "Edit Fixup" window for the "Put file path + name on upper left of all pages" fixup will open.

The numerous fields in this fixup are filled with values that will make the contents of the "Text" field show up in the upper left of all pages of the current page using Courier font in pink spot color.

The more interesting part of this fixup at least in this context is how the contents of the "Text" is defined.

  1. Click on the orange triangle popup to the right of the "Text" field.

A list of already defined variables is now shown, plus various options regarding existing or new variables.

  1. Click on 'Edit "place_filepath_text"...'

The "Edit Variable" window for the variable "place_filepath_text" will open.

Important: this not the same variable as the JavaScript variable defined in the QuickCheck step (which configures that Quick Check step), rather, it is a separate JavaScript variable that makes use of the information retrieved by the Quick Check step.

As that information will only be available if the fixup gets executed as part of a Process Plan, where in a previous step a suitable QuickCheck step has been executed. Some precautions are taken in the JavaScript code that give a kind of error message "filename @ filepath:  WARNING: required variables undefined" if the fixup is executed on its own or in a different Process Plan or Profile. This is managed by the if branch of the JavaScript code:

if (
	typeof app.vars.my_quickcheck_example 				                == 'undefined' ||   
	typeof app.vars.my_quickcheck_example.aggregated 		          == 'undefined' || 
	typeof app.vars.my_quickcheck_example.aggregated.file  	       == 'undefined' || 
	typeof app.vars.my_quickcheck_example.aggregated.file.filepath  == 'undefined' || 
	typeof app.vars.my_quickcheck_example.aggregated.file.name      == 'undefined'	
) 
{
	var myvar = "filename @ filepath:  WARNING: required variables undefined";
}

The intended main portion of the JavaScript variable is contained in the else branch:

else {
	var myvar = 	"filename:  «" 
				+ app.vars.my_quickcheck_example.aggregated.file.name 
				+ "»<br/>filepath: «"  
				+ app.vars.my_quickcheck_example.aggregated.file.filepath 
				+ "»"	;
}

This else branch creates a string built from two variables, app.vars.my_quickcheck_example.aggregated.file.name and app.vars.my_quickcheck_example.aggregated.file.filepath, concatenated with other bits of text into a nicely formatted string.

After closing this "Edit Variable" window, and then also the "Edit Fixup" window,  the "Edit Process Plan" window will be shown again. Instead of also closing this window and trying the Process Plan on one of your files,

  1. use the "Test" feature by clicking on the "Test" button

This will open the "Test profile" window – a very convenient environment to try Process Plans (or Profiles, Fixups and Checks) on a copy of a currently open PDF file without the risk of inadvertently breaking your files ("Test" processing is always carried out on temporary copies of your PDF files), and without tedious open/edit/close/apply cycles, and without any need to clean up processed copies of your PDF files.

As you can see in the screen shot some text is showing up in the upper left of the sample file used here (a PDF consisting of an empty A 4 sized page, and named accordingly).

0 Comments

Send Your Comment

E-Mail me when someone replies to this comment