Step by step - Learn how to use callas productscallas pdfToolboxReports for ProfilesHTML based custom reports – control custom parameters via JavaScript

HTML based custom reports – control custom parameters via JavaScript

The app.context.report.manifest JS object allows you to customize the manifest.xml for a custom PDF report from within a process plan or profile. You can use this JS object within a variable in pdfToolbox to enable and disable specific sections of the manifest.xml and to set new values for parameters using JavaScript.

Once an app.context.report.manifest JS object is specified, the parameters set in that object will overwrite the values in manifest.xml. For any parameter that does not have a custom value set in app.context.report.manifest, the values in manifest.xml are used.

Deactivate a specific section in manifest.xml via the app.context.report.manifest object

To deactivate a specific section in the manifest.xml there are two different options:

//Option 1 (null)

app.context.report.manifest = {
	"resources" : {
		"results": {
			"pageinfo": null
		}
	}
};


//Option 2 (false)


app.context.report.manifest = {
	"resources" : {
		"results": {
			"pageinfo": false
		}
	}
};
Click to copy

Activate a specific section in manifest.xml via the app.context.report.manifest object

To enable a specific section in manifest.xml there are 3 options:

//Option 1 (empty object)


app.context.report.manifest = {
	"resources" : {
		"results": {
			"pageinfo": {}
		}
	}
};


//Option 2 (true)


app.context.report.manifest = {
	"resources" : {
		"results": {
			"pageinfo": true
		}
	}
};


//Option 3 (at least one parameter is specified for that section)


app.context.report.manifest = {
	"resources" : {
		"results": {
			"pageinfo": {
				"resolution": 72
			}
	}
};
Click to copy

app.context.report.manifest is available as JavaScript snippet

To simplify use, the app.context.report.manifest JS object is available as a code snippet in pdfToolbox. After inserting the JavaScript snippet, you receive the JS object with all manifest.xml sections and default values. This can then be easily adapted to your own requirements.

  1. Click on the blue info icon next to the script editor in pdfToolbox
  2. Click on "Insert JavaScript snippets…"
  3. A new window opens where you can insert the app.context.report.manifest JS object
Complete app.context.report.manifest JavaScript object with all report parameters
  app.context.report.manifest = {
  "settings": {
    "keeptemp": false,
    "defaults": {
      "resolution": 20
    }
  },
  "resources": {
    "dict": {
      "overview": true
    },
    "results": {
      "xmlreport": {
        "path": "xml/report.xml",
        "inkcovres": 10,
        "inkcovbox": "CropBox"
      },
      "jsonreport": {
        "path": "json/report.json",
        "quickcheck": "default"
      },
      "jsonv2report": {
        "path": "jsonv2/report.json",
        "inkcovres": 10,
        "inkcovbox": "CropBox",
        "quickcheck": "none"
      },
      "preview": {
        "resolution": 20,
        "pageselector": "1"
      },
      "inkamountheatmaps": {
        "resolution": 20,
        "threshold": 300,
        "onlyproblems": true,
        "pageselector": "all",
        "show": true
      },
      "inkcoverage": {
        "resolution": 10,
        "pagebox": "CropBox",
        "pageselector": "all",
        "show": true
      },
      "spotcolors": {
        "pageselector": "all",
        "show": true
      },
      "separations": {
        "resolution": 20,
        "type": "spotifpresent",
        "pageselector": "all",
        "show": true
      },
      "pageinfo": {
        "pageselector": "1",
        "resolution": 20,
        "safetyzoneinside": "3mm",
        "safetyzoneoutside": "3mm",
        "usebleedbox": false,
        "unit": "mm",
        "show": true
      },
      "imageresolution": {
        "resolution": 20,
        "type": "img",
        "imgthreshold": 150,
        "bmpthreshold": 550,
        "onlyproblems": true,
        "pageselector": "all",
        "show": true
      },
      "smallobjects": {
        "resolution": 20,
        "type": "all",
        "threshold": "medium",
        "onlyproblems": true,
        "pageselector": "all",
        "show": true
      }
    }
  }
};
Click to copy