https://blog.csdn.net/weixin_41481806/article/details/87253819
//点击按钮后执行的方法
function printTag(){
var name = "李文龙-艾滋病";
var code = "20190113001";
var TSCObj;
TSCObj = new ActiveXObject("TSCActiveX.TSCLIB");
//TSC打印机的型号
TSCObj.ActiveXopenport("TSC TTP-244 Pro");
/**
* 标签的宽度
* 标签的高度
* 打印速度
* 打印浓度(0-15)
* 感应器类别字串型:0 垂直間距感測器(gap sensor)1 黑標感測器(black mark senso)
* Gap/Black mark垂直间距(mm)
* Gap/Black mark偏移距离(mm)
*/
TSCObj.ActiveXsetup("100", "40", "5", "12", "0", "2", "0");
TSCObj.ActiveXsendcommand("SET TEAR ON");//默认就行
TSCObj.ActiveXclearbuffer();//清除缓存
/**
* 文===字
* 文字X方向起点
* 文字Y方向七点
* 文字的高度
* 旋转角度
* 字体外形 0:标签;1:斜体;2:粗体;3:粗斜体
* 下划线 0:无下划线;1:加下划线
* 字体名称 如:Arial,Times new Roman
* 打印文字内容
*/
TSCObj.ActiveXwindowsfont(10, 30, 20, 0, 2, 0, "Arial", name);
/**
* 二===维===码
* X方向起始点
* 条码Y方向起始点
* 纠错级别
* 二维码高度
* A(A和M)
* 旋转角度
* M2(分为类型1和类型2)
* S1 (s1-s8,默认s7)
* 二维码的内容
*/
TSCObj.ActiveXsendcommand("QRCODE 140,25,L,2,A,0,M2,S3,\"" + name + code + "\"");
//需求出纸是四块的,所以又加了三个,只加X方向的值就行了
TSCObj.ActiveXwindowsfont(220, 30, 20, 0, 2, 0, "Arial", name);
TSCObj.ActiveXwindowsfont(220, 60, 20, 0, 2, 0, "Arial", code);
TSCObj.ActiveXsendcommand("QRCODE 350,25,L,2,A,0,M2,S3,\"" + name + code + "\"");
TSCObj.ActiveXwindowsfont(440, 30, 20, 0, 2, 0, "Arial", name);
TSCObj.ActiveXwindowsfont(440, 60, 20, 0, 2, 0, "Arial", code);
TSCObj.ActiveXsendcommand("QRCODE 570,25,L,2,A,0,M2,S3,\"" + name + code + "\"");
TSCObj.ActiveXwindowsfont(650, 30, 20, 0, 2, 0, "Arial", name);
TSCObj.ActiveXwindowsfont(650, 60, 20, 0, 2, 0, "Arial", code);
TSCObj.ActiveXsendcommand("QRCODE 780,25,L,2,A,0,M2,S3,\"" + name + code + "\"");
//条形码
//TSCObj.ActiveXbarcode("450", "90", "128", "60", "1", "180", "2", "2", code);
//打印的份数
TSCObj.ActiveXprintlabel("1", "1");
TSCObj.ActiveXcloseport();
}