Skip to main content

Metadata

As a print job flows with processors metadata is all passed along. This can be used for settings in the processor or modified along with way to be used in other processors. 

Example report

image.png

Meta data will start off with simple details like filename and header

{
    "started": "2025-07-22T09:43:41.964+08:00",
    "filename": "C:\\Users\\tristan\\Desktop\\20250721_153435_RAW_172.20.98.1.txt",
    "header": "                REPORT 1  -   Page # 1",
    "headercleaned": "REPORT 1 - Page # 1",
}

A processor could then manipulate that data in a pre-process or post-process javascript

image.png

This example analyzes the header and returns back to new values in the metadata of reportTitle and emailAddresses. 

function getReportDetails(header) {
if (header.includes("REPORT 1")) {
return {
reportTitle: "Report 1",
emailAddresses: "fred.bloggs@abitsystems.com.au"
};
}

if (header.includes("REPORT 2")) {
return {
reportTitle: "Report 2",
emailAddresses: "reports@abitsystems.com.au"
};
}

return {
reportTitle: header.replace(/\s+/g, ' ').trim(),
emailAddresses: "software@abitsystems.com.au"
};
}

function execute(val) {
var jsonData = JSON.parse(val);
if (jsonData.header) {
var reportDetails = getReportDetails(jsonData.header);
jsonData.reportTitle = reportDetails.reportTitle;
jsonData.emailAddresses = reportDetails.emailAddresses;
}
return JSON.stringify(jsonData, null, 2);
}

Because this is Pre-processed the processor can make use of these values immediately in it's own configuration as below. Variables that are from metadata are always prefixed with %metadata_{variablename}%

image.png

Now the metadata will reflect the following and is passed onto the next processor. 

{
    "started": "2025-07-22T09:43:41.964+08:00",
    "filename": "C:\\Users\\tristan.ABIT\\Desktop\\20250721_153435_RAW_172.20.98.1.txt",
    "header": "                REPORT 1  -   Page # 1",
    "headercleaned": "REPORT 1 - Page # 1",
    "reportTitle": "Report 1",
    "emailAddresses": "fred.bloggs@abitsystems.com.au",
    "smtpResult": "OK"
}