CodeSoft 2019 企业版打标签

官网只有2021版下载, 网上其他地方下载的也是试用版. 因为客户现在在用的是CodeSoft 2019, 为了兼容客户的需求, 使用CodeSoft 2019 企业版打标签

假如要用BarTender或者FastReport, 请看这里 用BarTender Vs FastReport 打印二维码 比较

引用Interop.LabelManager2.dll, 

public static ApplicationClass labApp = null;
public static Document doc = null;

//初始化
labApp = new ApplicationClass();
labApp.Documents.CloseAll(Save: false);
labApp.Documents.Open(labFileName);
doc = Program.labApp.ActiveDocument;

//退出程序时
labApp.Quit();
labApp = null;
doc = null;
GC.Collect(0);

打印前,给标签模板里的变量赋值,通常是二维码的流水号和一些文字说明,  doc.PrintDocument(1) 表示打印份数1份

doc.Variables.Item("SN1").Value = "SerialNoAAAA";
doc.Variables.Item("WO1" ).Value = workOrder + type;
doc.PrintDocument(1);

原文地址:https://www.cnblogs.com/zitjubiz/p/15356978.html