C#使用BarTender打印Label
来源:互联网 发布:网络带来的危害 编辑:程序博客网 时间:2024/05/29 07:17
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, FileMode.Open);//可以是其他重载方法
byte[] byData = new byte[fs.Length];
fs.Read(byData, 0, byData.Length);
fs.Close();
format.SubStrings["SN"].Value = strSN; //给打印模板中的参数SN赋值 。
//format.PrintSetup.PrinterName = @"HP1022_mis";
//engine.Stop(SaveOptions.SaveChanges);
format.PrintSetup.IdenticalCopiesOfLabel = int.Parse(this.txtPrintCount.Text == "" ? "1" : this.txtPrintCount.Text);
format.Print();
engine.Stop();
lblMessage.Text = "SN:" + strSN.ToUpper() + "打印成功,请再输入SN!";
this.txtWO.SelectAll();
this.txtWO.Focus();
}
- C#使用BarTender打印Label
- c# 使用bartender sdk 打印
- c# BarTender打印
- C#打印条码BarTender SDK
- C# 打印Label
- 使用 C# 进行 label 打印 的两种方式
- 使用 C# 进行 label 打印 的两种方式 .
- 使用Delphi调用条形码控件BarTender打印标签
- bartender打印错误
- [Bartender]C#调用BartenderSDK使用场景-客户标签案列
- C#调用BarTender 错误
- C#调用BarTender 模板
- Bartender条码使用方法C#
- Delphi 调用BarTender打印条码
- Bartender打印和导出图片
- BarTender如何打印额外字符
- Delphi 调用BarTender打印条码
- 用C#打印CS6的LABEL档
- 超参数调试
- 读书笔记——简单排序算法
- 安装Ansible
- SQL语句
- js中setTimeout()定时器的实现
- C#使用BarTender打印Label
- 代码重构(一):函数重构规则
- webpack 编译报错 Couldn't find preset "env"
- SpringBoot-Actuator应用监控以及优雅停机
- typedef与#define的区别
- C/C++:各种基本算法实现小结(四)—— 图及其遍历
- C++11实现生产者和消费者
- 621. Task Scheduler
- hibernate连接oracle数据库