I have some .lbl files and want to print them with an C# app. Is there any way to do this? I have them from Zebra Designer program, but I don't want use that program for printing labels.
Asked
Active
Viewed 2,689 times
1 Answers
1
The LBL file contains the internal binary format the Label Designer uses. You can not print that, as it is only for the Label Designer. You need to get ZPL code from the Label Designer. See this question on how to get the ZPL - basically, use the "Print to file" option.
You can verify that you have ZPL code opening the file in some text editor. There should be stuff like ^XA
, ^XZ
or ^PQ1,...
in the text. The way to send them to the printer highly depends on how the printer is connected to the network or the PC.
- Ethernet: This is the easiest case. Sent the ZPL code to the IP address of the printer. Some take input on port 9100, some on 6101. Consult your manual for this information.
- Serial connection: Open the COM port, send the ZPL code there. Easy.
- Windows printer driver: Really sucks. You need to talk to the printer driver in raw mode and send the ZPL there. There's some information here that will help you.
Extra tip: You can design your label to include placeholders for dynamic content. As ZPL files are plain text files, you can use your C# routine to on the fly replace placeholders with the real content.

Community
- 1
- 1

Thorsten Dittmar
- 55,956
- 8
- 91
- 139
-
In file is something like: "ĐĎࡱá > ţ˙ " and "˙˙ţ˙˙˙ ţ˙˙˙ ţ˙˙˙ţ˙˙˙ţ˙˙˙ţ˙˙˙ţ˙˙˙ţ˙˙˙ţ˙" Printer is connected by ethernet. – Avrack Dec 14 '15 at 13:38
-
This is probably the internal binary format of the label design. I suggest you have the Zebra Label Designer export ZPL code and send it to the printer as described above. This is the easiest: Open `TcpClient`, write ZPL to stream, close `TcpClient`. See here on how to get the ZPL: http://stackoverflow.com/questions/13586865/get-zpl-code-from-zebra-designer – Thorsten Dittmar Dec 14 '15 at 13:45
-
So I used "print to file" method and it's create a .prn file, where is "^XA ^MMT" but i can't find way how to print that. – Avrack Dec 14 '15 at 14:16
-
Well, as I said in my answer and my comments: Write a C# program that opens a TCP connection to the printer (IP address and port number required), send the contents of the prn file to the TCP stream and close the connection. Label is printed. – Thorsten Dittmar Dec 14 '15 at 14:19