21 Replies Latest reply on Apr 26, 2018 6:31 AM by James Sack

    We are in need of a working code example in C# that uses the Zebra.Printing.UsbPrinterConnector to query the printer status for the low paper condition.

    James Sack

      We use the following to print:

       

                   // Zebra KR403 Receipt Printer

                  var enumDevices = Zebra.Printing.UsbPrinterConnector.EnumDevices();

                  if (enumDevices.Keys.Count > 0)

                  {

                      string key = enumDevices.Keys[0];

                      Zebra.Printing.UsbPrinterConnector connector = new Zebra.Printing.UsbPrinterConnector(key);

       

                      string command1 = @"^XA^PW464~SD15" +

                      @"^FO05,100^A0N,32,32^FB450,1,0,C^FDTest Line^FS ";

       

                      command1 = command1 +

                      @"^CN1

                      ^PN0        

                      ^XZ";

       

                      byte[] buffer1 = ASCIIEncoding.ASCII.GetBytes(command1);

                      connector.IsConnected = true;

                      connector.Send(buffer1);

       

                      // Read paper status

                      string spaperout = "^XA~HQES^XZ\n";

                      byte[] buffer2 = new byte[];

                      buffer2 = ASCIIEncoding.ASCII.GetBytes(spaperout);

                      connector.Send(buffer2);

                      byte[] buffer3 = new byte[];

                      int bytesread = connector.Read(buffer3, 0, 512);

              }

       

      We encounter errors while trying to read the low paper status.

       

      Jim