1.首先下载BarTender。
2.在CS代码中引用using Seagull.BarTender.Print,否则无法打印。
3.使用BarTender制做打印模板SN.btw(eg)。
3.代码:
本例:只做一个简单的SN的打印。
public void Print(string strSN)
{
string tempPath = System.AppDomain.CurrentDomain.SetupInformation.ApplicationBase + "Temp\\SN.btw";
string tempPath1 = System.AppDomain.CurrentDomain.SetupInformation.ApplicationBase + "Temp\\SN.btw";
Engine engine = new Engine(true);
//use the engine to open a format document to return a LabelFormatDocument object
engine.Start();
LabelFormatDocument format = engine.Documents.Open(tempPath1, this.txtPrint.Text);// this.txtPrint.Text打印机名
//LabelFormatDocument format = engine.Documents.Open(tempPath);
FileStream fs = new FileStream(tempPath, F