码迷,mamicode.com
首页 > Windows程序 > 详细

条码打印四 - 4.C#Zebra斑马便携式打印机Wifi TCP打印

时间:2020-01-09 10:20:52      阅读:106      评论:0      收藏:0      [点我收藏+]

标签:net   com   条码   tcp   print   style   connect   string   class   

 1 // Printer IP Address and communication port
 2 string ipAddress = "10.3.14.42";
 3 int port = 9100;
 4  
 5 // ZPL Command(s)
 6 string ZPLString =
 7     "^XA" +
 8     "^FO50,50" +
 9     "^A0N50,50" +
10     "^FDHello, World!^FS" +
11     "^XZ";
12  
13 try
14 {
15     // Open connection
16     System.Net.Sockets.TcpClient client = new System.Net.Sockets.TcpClient();
17     client.Connect(ipAddress, port);
18  
19     // Write ZPL String to connection
20     System.IO.StreamWriter writer =
21 new System.IO.StreamWriter(client.GetStream());
22     writer.Write(ZPLString);
23     writer.Flush();
24  
25     // Close Connection
26     writer.Close();
27     client.Close();
28 }
29 catch (Exception ex)
30 {
31     // Catch Exception
32 }

 

条码打印四 - 4.C#Zebra斑马便携式打印机Wifi TCP打印

标签:net   com   条码   tcp   print   style   connect   string   class   

原文地址:https://www.cnblogs.com/turnip/p/12169882.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!