Click here to Skip to main content
15,889,034 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi my friends.

How can I print to zebra zm400 printer in c# platform ?

codes;

"^PRC"+
"^LH0,0^FS"+
"^MD16"+
"^MNY"+
"^BY2,0^FO30,20^BCN,50,N,N,N^FR^FD>;" + textBox1.Text + "^FS"+
"^FO50,75^A0,24,0^CI0^FR^" + textBox1.Text + "^FS"+
"^XZ";

Thanks for your help.
Posted

Copy this code from MS http://support.microsoft.com/kb/322091[^]
Then pass to it the printer name + those ZPL commands. That's it.
 
Share this answer
 
Write all the text to a file.... bill.txt
Create a Batch file with this content.. "Print.bat"

type bill.txt>prn
exit

RUn this file using C#....
 
Share this answer
 
v2
Comments
agora1905 21-Aug-13 7:11am    
I have just a button and text box. But I cant print it :(

my project;

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;

namespace barkod
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
textBox1.Select();
}


private void button1_Click(object sender, EventArgs e)
{
StringBuilder sBuilder = new StringBuilder();
sBuilder.AppendLine("^XA");
sBuilder.AppendLine("^PRC");
sBuilder.AppendLine("^LH0,0^FS");
sBuilder.AppendLine("^MD16");
sBuilder.AppendLine("^MNY");
sBuilder.AppendLine("^BY2,0^FO30,20^BCN,50,N,N,N^FR^FD>;" + textBox1.Text + "^FS");
sBuilder.AppendLine("^FO50,75^A0,24,0^CI0^FR^" + textBox1.Text + "^FS");
sBuilder.AppendLine("^XZ");
textBox1.Text = "";



// her line AppendLine ile eklenecek

AddToLog(sBuilder.ToString(), "c:\\barkod\\");
}

public static void AddToLog(string logText,string path)
{
if (!Directory.Exists(path))
Directory.CreateDirectory(path);

string cmd = "etiket.bat";
string dosya = "etiket.out";

if (!File.Exists(path + cmd))
File.WriteAllText(path + cmd, "");

if (!File.Exists(path + dosya))
File.WriteAllText(path + dosya, "");

File.WriteAllText(path + cmd, logText, Encoding.UTF8);
File.WriteAllText(path + dosya, logText, Encoding.UTF8);

}
}
}
agora1905 21-Aug-13 8:32am    
Help please.
agora1905 21-Aug-13 9:25am    
I solved my problem with Yesudasan Moses, thanks.

I used this;

Process.Start("C:\\barkod\\etiket\\etiket.bat");

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900