write doesn't return error for out of paper

I expected that if I attempted to write to a printer without paper in it (e.g. it just ran out of paper), that I would get an error from the write command.

In the below code, no error is logged.  If I set a breakpoint, I am able to verify that writeError is nil.

 

      let zebraConnection = MfiBtPrinterConnection(serialNumber: serialNumber)

      DispatchQueue.global(qos: .utility).async(execute: {

        if (zebraConnection?.open())! {

          .

          .

          .

          var writeError: NSError?

          zebraConnection?.write(printReceipt.data(using: String.Encoding.utf8), error: &writeError)

          if writeError != nil{

            DDLogError("Print to zebra errored with error: \(writeError?.localizedDescription)")

          }

          zebraConnection?.close()

       }

 

iMZ220 with firmware V73.20.01Z

link-OS v1.4.957 for iOS

 

What is wrong with my approach? 

 

Thanks,

Del

Del Brown
Also should note that putting

Also should note that putting paper in the printer, causes it to print what was previously sent to the printer.  So the writes weren't lost...  But I would like a way to communicate to the end user that the printer needs paper.

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Manuel Caicedo-...
Hi Del,Please, try this:

Hi Del,

Please, try this:

*printerStatus = [printer getCurrentStatus:&error]; if (printerStatus.isReadyToPrint) { NSLog("Ready To Print"); } else if (printerStatus.isPaused) { NSLog("Cannot Print because the printer is paused."); } else if (printerStatus.isHeadOpen) { NSLog("Cannot Print because the printer head is open."); } else if (printerStatus.isPaperOut) { NSLog("Cannot Print because the paper is out."); } else { NSLog("Cannot Print."); }

For more info, please, review the printerstatus class on our API online, link below.

Link-OS SDK - Zebra Technologies Techdocs

Thanks,

MC

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Log in to post comments