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
Print From ZPL StringIs 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 |
Subscribe to email updates
Monthly updates from our Zebra development team, straight to your inbox.
1 Replies
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(); } }