Novell is now a part of Micro Focus

How can I cancel a print job, if...

Articles and Tips: qna

01 Jan 2003


Q.

How can I cancel a print job, if all I know about the job is the opened printer handle that it is using? The problem is that the StartDocPrinter of the NDPS and queue-based print providers always return a job ID of 1.

A.

Use NWRemoveJobFromQueue2. This function requires a queue ID and a job ID. To get the queue ID, create a connection to the server, then use NWDSMapNameToID to get the server-centric ID for the queue object. To get a job ID, call NWGetQueueJobList2 and the returned structure QueueJobListReply.

The jobNumberList "member" of the QueueJobListReply structure contains the list (in order) of the jobs that are currently in the queue. The first entry "[0]" would be the first "ready" job. If the job is already printing, you can no longer control it (since it being de-spooled to the print server).

* Originally published in Novell AppNotes


Disclaimer

The origin of this information may be internal or external to Novell. While Novell makes all reasonable efforts to verify this information, Novell does not make explicit or implied claims to its validity.

© Copyright Micro Focus or one of its affiliates