1 Reply Latest reply on Feb 9, 2017 9:20 AM by Manuel Caicedo-Rivera

    Get notified when receipt has physically finished printing

    Del Brown

      link-os SDK for iOS 1.4.957

      Zebra iMZ220

       

      I am currently using ZebraPrinterConnection's write:error to print receipts.

       

      Is there a different approach that would inform me when the receipt has physically finished printing?  I think write:error just tells me if the write completed successfully and/or if it had an error.

       

      Thanks,

      Del

        • Re: Get notified when receipt has physically finished printing
          Manuel Caicedo-Rivera

          Hi Del,

           

          I am adding this method from our Xamarin sample code. You can review the logic behind it, and implement it directly in IOS. We do not have this code in IOS, so you will need to adapt this logic to your code.

           

          The main idea is that you can invoke this method once you sent your print job to the printer to check two statuses while the printer is printing. One is with the status.IsReadyToPrint and the second is with the status.NumberOfFormatsInReceiveBuffer. The second will tell you when the buffer is empty, it means that there is not a print-job, or the print-job just finalized. The other portions of the code are to check if printer found an error during the printing job (out of paper, etc).

           

          protected bool PostPrintCheckStatus(IZebraPrinter printer)

          {

          // Check the status again to verify print happened successfully

          IPrinterStatus status = printer.CurrentStatus;

          // Wait while the printer is printing

          while ((status.NumberOfFormatsInReceiveBuffer > 0) && (status.IsReadyToPrint))

          {

          // printing

          status = printer.CurrentStatus;

          }

          // verify the print didn't have errors like running out of paper

          if (!status.IsReadyToPrint)

          {

          ShowErrorAlert("Error durring print. Printer is " + status.Status);

          return false;

          }

          // label(s) printed

          return true;

          }

           

          Thanks,

           

          MC