I believe this boils down to the job-state-message attribute. To get job attributes, I believe that you will have to use the IPP API, though, for example (unchecked):
ipp_t *request = ippNewRequest(IPP_GET_JOBS); ... ipp_t *response = cupsDoRequest(CUPS_HTTP_DEFAULT, request, "/"); ... ipp_attribute_t *attr = ippFindAttribute(response, "job-state-message", IPP_TAG_TEXT);
It is important to note that job-state attributes can be updated at some point after the job has already been accepted. Since the server does not know whether the print will be really successful (due to Murphy Law there are many factors), the job is accepted, and after a failure, it updates the job-state and the corresponding attributes, respectively. job-state-message is optional, though.
If you want your application to respond to these events rather than continuing to request a CUPS server at a fixed interval, you can subscribe to some D-Bus events ( see Apple implementation ). If you want an example consumer implementation, you can read the printer panel code from the gnome control center .
Below I will try to list some relevant parts of RFC 2911 (IPP 1.1):
3.1.9 Task creation operations
...
During job processing, since the Printer object already responded with a successful status code in response to the creation of the request, if the Printer object detects an error, the Printer object cannot inform the end user of the error using the status code operation. In this case, the printer, depending on the error, can set the job object "job status", "job reasons" or "job - state-message" to the corresponding values (s) so that later requests can report the correct job status.
Note. Asynchronous event notification is beyond the scope of this IPP / 1.1 document.
4.3.7 job status (enumeration type1)
...
6 “processing-stopped”: the task stopped during processing for a number of reasons and will return to “processing” as soon as the reasons are no longer present.
The job-state-reason-job MAY attribute indicates why work stopped processing. For example, if the output device is stopped, the value "printer is stopped" MAY be included in the job attribute "Status-reason-job".
Note. When the output device is stopped, the device usually indicates its state in a human readable form locally on the device. The client can obtain a more complete remote device by requesting the "Printer Object" object "printer status", "printer status reasons" and "printer-state-message".
4.3.9 status message (text (MAX))
This attribute defines information about the "state of the job" and the "job - state-reason" in a human-readable text. If the printer object supports this attribute, the Printer object MUST be able to generate this message in any of the natural languages defined by the "natural language-generated" attribute (see the attribute attribute "natural language operation" specified in Section 3.1.4.1) .
The value SHOULD NOT contain additional information that is not contained in the values of the attributes “work state” and “state of job-causes”, such as information about interpreter errors. Otherwise, application programs may try to parse (localized text). For such additional information, such as interpreter errors for the application, program consumption or access errors to a specific document, new attributes with keyword values must be developed and recorded.
footnote : I did not do this personally, but the RFC does tell you exactly what you should expect.