PC .NET c# change from isPaused/isPaperOut to isReadyToPrint

// Expert user has replied.
S Sal Quintanilla 3 years 7 months ago
3 2 0

We're using a Zebra ZD410-300dpi ZPL in an embedded application that will load labels separately as needed. I need to restore operations to our printer programmatically. When a particular error occurs, I run this (sequenced from several separate methods in my code);
zebraPrinter.Reset();
while (true)
{
List connectedUsbPrinters
= UsbDiscoverer.GetZebraUsbPrinters(new ZebraPrinterFilter());
if (connectedUsbPrinters.Count == 1)
{
Connection printerConnection = new UsbConnection(connectedUsbPrinters[0].Address);
printerConnection.Open();
string setupCommand = "^XA^MFN,N^JUS^XZ";
zebraPrinter.SendCommand(setupCommand);
break;
}
}
PrinterStatus printerStatus = zebraPrinter.GetCurrentStatus();
if (printerStatus.isReadyToPrint)
{
return SUCCESS;
}
There's more to it in terms of waiting, but that's basically it, and it works for most cases. However, we have a case where I send the setup and string to print using zebraPrinter.SendCommand(print_commands) and no label is in the printer. This is of course an error, and I detect that and do the reset sequence above. But in this case, after reset, I get
printerStatus.isPaused = true
printerStatus.isPaperOut = true
Yes, this is true and reflects what happened, but I didn't expect that to persist after doing the zebraPrinter.Reset() call.
All that for this question: Is there anything I can do before or after a zebraPrinter.Reset() to get back to a printerStatus.isReady state, other than sending a ~JR to do a Power On Reset?
Thanks for reading.
Sal

Please Register or Login to post a reply

2 Replies

R Robin West

Thanks Sal, Sorry, didn't fully read the code you had.  I think I need more info.  Are you resetting (soft power cycle) between checking the status again?  Just setitng the ^MF will not clear the error.  Is the printer still out of paper, or is it giving a false reading after reset?  Can you give a little more detail on the steps you use to reproduce?  
(I'm a site moderator so I have access to more options.  I think the plan is to open up some these options to external users soon, but they are going through security review)

R Robin West

You are likely getting the above errors because the printer is set to try and calculate the label length after reset.  This is default behavior but can be changed to do nothing on reset:

^XA^MFN^XZ^XA^JUS^XZYou only need to send this command once and it will persist.  

CONTACT
Can’t find what you’re looking for?