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

2021-01-18 22:11

阅读:520

标签: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


评论


亲,登录后才可以留言!