Is there a way to capture the size of a label in a zebra printer.

R Robert Thompson 3 years 7 months ago
427 1 0

Hi I need to be able to capture the size of the label in a printer.  I would like to notify the user that the label that is being sent needs to be changed if the label is not the correct size. Ex:  If I am sending a 4x2 and the label printer has a 6x4. Do not print and send an error message. If there away in doing this using the zebra.sdk.printer. The below example code is working great for me.   public static void Main(string[] args) {         Connection connection = new TcpConnection("192.168.1.100", TcpConnection.DEFAULT_ZPL_TCP_PORT);         try {             connection.Open();             ZebraPrinter printer = ZebraPrinterFactory.GetInstance(connection);             PrinterStatus printerStatus = printer.GetCurrentStatus();             if (printerStatus.isReadyToPrint) {                 Console.WriteLine("Ready To Print");             } else if (printerStatus.isPaused) {                 Console.WriteLine("Cannot Print because the printer is paused.");             } else if (printerStatus.isHeadOpen) {                 Console.WriteLine("Cannot Print because the printer head is open.");             } else if (printerStatus.isPaperOut) {                 Console.WriteLine("Cannot Print because the paper is out.");             } else {                 Console.WriteLine("Cannot Print.");             }         } catch (ConnectionException e) {             Console.WriteLine(e.ToString());         } catch (ZebraPrinterLanguageUnknownException e) {             Console.WriteLine(e.ToString());         } finally {             connection.Close();         }     }

Please Register or Login to post a reply

1 Replies

E Efkan YILMAZ

Hi Robert,
you can use the SGD class to get settings like label length and width.
String width= SGD("ezpl.print_width", connection);
String length=SGD("zpl.label_length", connection);
A list of SGD settings can be found in the ZPL manual.

As an FYI, the label length is usually set with sensors, but the width is set by the user and is default at the maximum for that printer.  There are no width sensors.

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