Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Event Documentation #63

Open
credas-dev opened this issue Jan 22, 2024 · 2 comments
Open

Event Documentation #63

credas-dev opened this issue Jan 22, 2024 · 2 comments

Comments

@credas-dev
Copy link

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?

@neodynamic
Copy link
Owner

The possible values are listed here https://learn.microsoft.com/en-us/windows/win32/printdocs/job-info-1

@credas-dev
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants