Event Documentation
When following the documentation here is there any more documentation surrounding the events?
I'm speaking more directly about the job state and `state-descriptions.
cpj.onUpdated = function (data) {
$("#txtPrintJobTrace").val($("#txtPrintJobTrace").val() + "> " + JSON.stringify(data) + "\r\n");
console.info(data);
};
cpj.onFinished = function (data) {
$("#txtPrintJobTrace").val($("#txtPrintJobTrace").val() + "> " + JSON.stringify(data) + "\r\n");
console.info(data);
};
cpj.onError = function (data) {
$("#txtPrintJobTrace").val($("#txtPrintJobTrace").val() + "> " + JSON.stringify(data) + "\r\n");
console.info(data);
};
The data looks something like below
{"id":63,"state":8210,"state-description":"ERROR,PRINTING,RETAINED","completed-pages":0,"date-completed":null,"date-creation":null,"date-processing":null,"name":"MY_FILE_NAME.pdf","printer":"MY_PRINTER_NAME","total-pages":2,"user":"username","paper":"Letter","priority":1,"total-bytes":null,"printed-bytes":null}
If I wanted to do perform a switch statement on all of the available values for state what would they be?
The possible values are listed here https://learn.microsoft.com/en-us/windows/win32/printdocs/job-info-1
As a follow-up, it states
Status
The job status. The value of this member can be zero or a combination of one or more of the following values. A value of zero indicates that the print queue was paused after the document finished spooling.
It doesn't really give a definitive list of available values.
Also following the documentation here is there a way to to get the print job ID associated with the command cpj.sendToClient();?
If I send the same file to the printer twice, it's not clear which job instance is returned in the onUpdated event.
Thanks