Zebra Printer Pausing after TCP Send using SDK

475 views Asked by At

I am using the Zebra Link-OS SDK nuget to take advantage of the printer's operating system features including, connectivity, printing and management tasks.

I am sending several pages to several different zebra printers, all older models. I am using the Zebra C# SDK to do this following the examples they have. I am sending a page to each printer around every 500ms. When I do this, some of the printers randomly "PAUSE" themselves and stop printing. Hitting the "Pause" button on the printer removes the pause and resumes the print job. No pages are lost, it's just frustrating because a user has to stand there and continuously "unpause" the printer for it to start printing. Changing the time to delay between print jobs doesn't seem to make a difference. The client has another app which uses spooler queues instead of TCP and it doesn't seem to make this happen. Is there a setting somewhere on the printer I can adjust to stop this, or any change I can make to the code that stops this random PAUSE?

var Zebra.Sdk.Comm.Connection thePrinterConn;
thePrinterConn = new Zebra.Sdk.Comm.TcpConnection(IPAddress, TcpConnection.DEFAULT_ZPL_TCP_PORT);    

public string SendZplOverTcp(string zplPayload)
{                        
    if (!MockSending)
    {
        try
        {
            // Open the connection - physical connection is established here.
            thePrinterConn.Open();
            if (!thePrinterConn.Connected)
            {
                return  "ERROR : PRINTER OFFLINE";
            }
           

            // Send the data to printer as a byte array.
            thePrinterConn.SendAndWaitForResponse(Encoding.UTF8.GetBytes(zplPayload), 1000, 500, "\\r");
        }
        catch (Exception e)
        {
            // Try again if it failed, wait for Printer to consume all it's data, or for 15 seconds

            thePrinterConn.WaitForData(15000);
            thePrinterConn.SendAndWaitForResponse(Encoding.UTF8.GetBytes(zplPayload), 1000, 500, "\\r");

            // if it fails again here, bubble the error up so we can log it with label data intact

        }
    }
    // don't close connection automatically, otherwise it will have to re-open on the next pass

    return "OK";
}
1

There are 1 answers

0
David C On BEST ANSWER

I wasn't able to figure out why it was pausing on it's own, but I did find a way to resolve the issue a different way.

In the printer service, using the SDK I can check to see if the printer is paused, and if so, issue a ZPL command to resume printing prior to sending the ZPL for the page to the printer.

public ZebraPrinter printer;
printer = ZebraPrinterFactory.GetInstance(thePrinterConn);

if (printerStatus.isPaused)
  {    
    thePrinterConn.SendAndWaitForResponse(Encoding.UTF8.GetBytes("^XA~PS^XZ"), 1000, 500, "\\r");
  }