Print From ZPL String

P Paul Freeman 3 years 7 months ago
692 1 0

Is there a way to send a ZPL string using .net linkOS sdk?  I know you can print from file, but in order to make it faster I would like to save my string in the Database or even in code and just send it.

Thanks,

Paul

Please Register or Login to post a reply

1 Replies

E Efkan YILMAZ

Hi Paul, Yes definitely.
You can just use the connection.Write() to send a ZPL string to the printer.
TcpConnection Class
// from the TCPConnection Class on Zebra Techdocs:private void SendZplOverTcp(string theIpAddress) {  // Instantiate connection for ZPL TCP port at given address  Connection thePrinterConn = new TcpConnection(theIpAddress, TcpConnection.DEFAULT_ZPL_TCP_PORT);  try {  // Open the connection - physical connection is established here.  thePrinterConn.Open();  // This example prints "This is a ZPL test." near the top of the label.  string zplData = "^XA^FO20,20^A0N,25,25^FDThis is a ZPL test.^FS^XZ";  // Send the data to printer as a byte array.  thePrinterConn.Write(Encoding.UTF8.GetBytes(zplData));  } catch (ConnectionException e) {  // Handle communications error here.  Console.WriteLine(e.ToString());  } finally {  // Close the connection to release resources.  thePrinterConn.Close();  }  }

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