iOS has a printing feature known as AirPrint, which does not require to install a specific device driver. My iOS App prints an image data through AirPrint, but sometimes print queue of AirPrint gets stuck. Print queue of AirPrint is FIFO and if the first job remains with some reasons such as temporary network failure, the next job will not send to the printer.
Thus I wish to flush Print queue, or cancel a dead job in case of getting stuck in Print Queue. I know we can cancel printing jobs in Print Center (background app of iOS printing system), but I wish to do that in my own iOS app.
Questions:
(1) Can we cancel or clear printing jobs in Print Queue of AirPrint from iOS app? (I really appreciate if you have a sample code of Swift to do such a thing!)
(2) Does anyone know how long it takes for printing jobs to get timed out?
Any suggestion would be welcomed.
Reference of AirPrint: https://developer.apple.com/library/archive/documentation/2DDrawing/Conceptual/DrawingPrintingiOS/Printing/Printing.html#//apple_ref/doc/uid/TP40010156-CH12-SW2
There is a UI available in iOS for PrintJob Management. So there might be an API available.
If an iOS-PrintJob returns the ipp job-uri you could implement print job management within your app. You'd have to implement the ipp protocol and support the Cancel-Job operation.
iOS uses CUPS as ipp client. I have analysed the behaviour of iOS by running tests against my own AirPrint implementation. The http User-Agent used is "CUPS/2.3.4 (iOS 14.4.2; iPad8,3) IPP/2.0"
iOS only cares about successful print job submission. It does query the job state though via the Get-Job-Attributes operation. It would make sense that iOS presents a UI that allows the user to monitor (and control) a print job. We should file a bug or feature request for iOS @Apple.
iOS also queries the printer state. In my tests when I stop my AirPrint server I get notified that the printer is offline and I am presented an option to cancel or try again.
When the printer-state is 'stopped' and reason is 'paused' the print center is available!
Summary: Job monitoring and control is available via the print center. It depends on the AirPrint implementation wether the print center shows up.