Execute external application via JavaScript function

callas pdfToolbox allows you to execute an external application via JavaScript function.

 The application has to be present in the user preferences at “…/Variables/execFileSync”.

Where to find User Preferences in Windows and Mac?

User Preferences here:

/Users/<USERNAME>/Library/Preferences/callas software/callas pdfToolbox <VERSION>
C:\Users\<USERNAME>\AppData\Roaming\callas software\callas pdfToolbox <VERSION>

  • cmd: name of a tool that must be present in <PREFS>/Variables/execFileSync with execute rights
  • args: Optional array of arguments that are passed to cmd. It can either be a string "param" or an array of strings [""param1, "param2"] (if more than one parameter is needed)
  • options: Optional. Currently supported properties are:
    • cwd: The cwd command is issued to change the client's current working directory to the path specified with the command. Default is the parent folder of the current document
    • timeout: <number> In milliseconds the maximum amount of time the process is allowed to run


The command will return an object containing the status stdout and stderr of the command execution:

  status: 0,

Exception thrown when:

  • cmd cannot be found in folder <PREFS>/Variables/execFileSync 

  • cmd is not an executable: The cmd file is not set to 'executable' in the file system. In that case the command line call "chmod +x<executable>" will help.

  • cmd is a shell script and has no shebang entry (e.g. #! /bin/bash)

Please note that this feature is  not portable since the commands are not included in the kfpx packages and the commands may differ between platforms.

Please note that executing an external application via JavaScript function creates an additional security risk.


Please note that 'verapdf' application is placed under:
/Users/<username>/Library/Preferences/callas\ software/callas\ pdfToolbox\ 12/Variables/execFileSync

  • cmd: verapdf
  • args: --version
  • options:
    • timeout: 500