Up until recently we have always shared our printing sample code on the Zebra Support / Knowledge Management site. Due to popular demand, we have been migrating most of our samples to Github. In fact, you can find samples and source code for many Zebra products there. The printing samples are under the name LinkOS-OS-Samples. Each individual sample is on it's own branch.
Note: We will be shutting down the Knowledge Management site in the next month. We are working to update links, please keep in mind this is a content migration and be patient with us.
While we were going through our samples we found a few old code snippets. Here is one of them that some of you might still find useful:
Send ZPL Commands via TCP/IP in VB.netConfidential and Proprietary
The source code and other information contained herein is the confidential and the exclusive property of ZIH Corp. and is subject to the terms and conditions in your end user license agreement. This source code, and any other information contained herein, shall not be copied, reproduced, published, displayed or distributed, in whole or in part, in any medium, by any means, for any purpose except as expressly permitted under such license agreement.
Copyright ZIH Corp. 2012ALL RIGHTS RESERVEDPurpose
This application demonstrates how to send ZPL commands to a network ZPL printer. It uses TcpClient to accomplish the communication. It was written in Visual Studio 2008 in C# and tested successfully on a Windows XP machine with Service Pack 3 .Sample Code
Dim ipAddress As String = "10.3.14.59"
Dim port As Integer = 9100
Dim ZPLString As String = _
"^XA" & _
"^FO50,50" & _
"^A0N,50,50" & _
"^FDHello, World!^FS" & _
Dim client As New System.Net.Sockets.TcpClient
'Write ZPL String to Connection
Dim writer As New System.IO.StreamWriter(client.GetStream())
Catch ex As Exception
'Catch Exception Here