调用BarTender打印条码的问题
大家好,用下面代码打印条码时,条码打印机没有反应,但也没有错误回报,哪里有问题?
一开始刚连打印机调试的时候还可以打印,后来就不行了。。
真的没办法了,拜托大家帮我看看。。
下面是代码:
private void PrintInfo(int number,string path,string PrintName)
{
//BarTender.Messages messages;
try
{
btFormat = btApp.Formats.Open(@path, false, "");
}
catch
{
MessageBox.Show("找不到相关模板!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
btFormat.PrintSetup.IdenticalCopiesOfLabel = number;//设置同序列打印的份数
string Qr = "供应商名:" + txtGY.Text.Trim() + "@批次:" + txtPC.Text.Trim() + "@物料编码:" + txtWB.Text.Trim() + "@物料名称:"
+ txtWM.Text.Trim() + "@物料规格:" + txtWG.Text.Trim() + "@采单:" + txtCG.Text.Trim() + "@数量:" + txtSL.Text.Trim();
btFormat.SetNamedSubStringValue("AllMessage", Qr);
btFormat.SetNamedSubStringValue("CompanyName", txtGY.Text.Trim());
btFormat.SetNamedSubStringValue("PurchaseOrder", txtCG.Text.Trim());
btFormat.SetNamedSubStringValue("Batch", txtPC.Text.Trim());
btFormat.SetNamedSubStringValue("MaterialNumber", txtWB.Text.Trim());
btFormat.SetNamedSubStringValue("MaterialName", txtWM.Text.Trim());
btFormat.SetNamedSubStringValue("MaterialSpecifications", txtWG.Text.Trim());
btFormat.SetNamedSubStringValue("Number", txtSL.Text.Trim());
btFormat.Printer = PrintName;
btFormat.PrintOut(false, false);
btFormat.Close(BarTender.BtSaveOptions.btDoNotSaveChanges);
}