Dump variables report (using JSON)

Beginning with pdfToolbox 10, a new report type is available on command line (and in Switch):

VARDUMP:   Dumps the app.vars object into JSON

This report dumps all Variables and their values in a JSON file. The other report options can be used e.g. in order to specify the location and the name with which the JSON report is created.

The JSON file contains a "vars" object and key value pairs for all Variables.
This report type can be helpful for use cases, where JavaScript Variables are e.g. calculating multiple thresholds based on a single Variable defined during runtime or when a JavaScript Variable is deriving information about the PDF itself.

The report can be used in Switch as a dataset or in other workflow applications, MIS-systems or any other applications that integrate pdfToolbox in order to export any kind of information that is available in the pdfToolbox internal JavaScript object.

pdfToolbox Viewing Distance related checks.kfpx <any PDF> --report=vardump

The content of the vardump JSON for this CLI call will be:

   "vars" :
      "Calcs_for_LFP_Preflight_-_viewing_distance" : 200,
      "eff_min_fontsize" : 200,
      "eff_min_imageresolution" : 40,
      "input_scalingfactor" : 100,
      "input_viewingdistance" : 10

And will vary if the values of the Variables "input_viewingdistance" and "input_scalingfactor" are changed using --setvariables=...

Note: The used Profile is part of the "Shapes, Variables, JavaScript, Place content" Library and contained in the Desktop version.


Mark Redman

How exactly is this used? Can we have an example please?

Author callas software

Hi Mark,
Thank you for your comment - I have added a small sample to this article and hope this makes it more clear.
Best regards,
Marc Heusmann

Send Your Comment

E-Mail me when someone replies to this comment