Get it on GitHub!

Anonymous (not verified) -
2 MIN READ

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.net

Confidential 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. 2012
ALL RIGHTS RESERVED

Purpose

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" & _

      "^XZ"

 

Try

      'Open Connection

      Dim client As New System.Net.Sockets.TcpClient

      client.Connect(ipAddress, port)

 

      'Write ZPL String to Connection

      Dim writer As New System.IO.StreamWriter(client.GetStream())

      writer.Write(ZPLString)

      writer.Flush()

 

      'Close Connection

      writer.Close()

      client.Close()

 

Catch ex As Exception

 

      'Catch Exception Here

 

End Try

profile

Anonymous (not verified)

Dfghjkjjn

Please register or login to post a reply

3 Replies

V Vedsatx Saddvv

Hi Everyone, For your reference, the Samples are branched from the main projects.  Find them here:

s shaoxiong wang

<a href="https://km.zebra.com/kb/index?page=home">Zebra Support / Knowledge Management</a>&nbsp;&nbsp; seems no available. Feel sad for the website does not work all the time.

V Vedsatx Saddvv

Hi, this is one of the reasons we're moving to a more available site like GitHub.&nbsp; Knowledge Management is working again now though.