Search code examples
printingcupsipp-protocol

CUPS returns 'complete' on jobs which are still printing


I am communicating with CUPS using IPP protocol. I have all drivers for my printers installed in CUPS (using .ppd file) and printers got latest firmware.

When I query a job which a printer printing right now it says that the job's state is 'complete' before the printer even finish printing. It seems that the CUPS marks the job as 'complete' when it finish 'uploading' the file.

I would not expect this behaviour and I basically need to know when exactly the printer printed last paper for a job. The code looks as follow. The self.printer().ippPrinter() is an instance of node-ipp and it points to a printer. To read the the state of the job I am using attribute 'job-state'.

var msg = {
  "operation-attributes-tag": {
    'job-id': id
  }
};

self.printer().ippPrinter().execute("Get-Job-Attributes", msg, function(err, res){
  var attributes = res['job-attributes-tag'];

  self.setAttributes = attributes;
  callback.call(self, attributes);
});

Does anyone know why I am having this issue or .. how to make it working? Thank you!


Solution

  • CUPS can only forward job-states received from the printer. A lot of printer drivers and protocols work like 'fire and forget'.

    Usually IPP printers allow CUPS and other clients to monitor the current job-state until it's finished/printed. Some manufacturers don't implement IPP properly and classify submitted jobs as printed - even if the printer has a paper jam!

    Conclusion:

    If your printer does not fully support IPP you probably won't be able to check for 'printed successfully'.


    RFC 8011 5.3.7.1

    If the implementation is a gateway to a printing system that never provides detailed status about the Print Job, the implementation MAY set the IPP Job’s state to ’completed’, provided that it also sets the ’queued-in-device’ value in the Job’s "job-state-reasons" attribute