TSC打印机编程C#

源码下载地址:https://download.csdn.net/download/horseroll/10473952

正常使用打印方法:

public void dayin(string url)
{
    TSC.openport("TSC TE344");//打开端口
    TSC.clearbuffer();//清除缓存
    string strurl = "\"" + url + "\"";
    string str = "QRCODE 400,310,L,10,A,0,M2,S7," + strurl;//确认二维码位置大小等代码
    TSC.windowsfont(120, 50, 80, 0, 0, 0, "新楷体", "有限公司");//打印中文字
    TSC.sendcommand(str);//打印二维码
    TSC.windowsfont(120, 670, 80, 0, 0, 0, "新楷体", "包装日期及批号:" + DateTime.Now.ToString());
    TSC.printlabel("1", "1");
    TSC.closeport();
}
首先先把TSCLIB.lib和TSCLIB.dll文件复制到C盘windows/system32目录下

TSC.cs是封装的一个类,源码往下翻。

TSC.openport()、TSC.clearbuffer()、TSC.printlabel()、TSC.closeport()这四个方法是必须的,内容在中间进行添加



猜你喜欢

转载自blog.csdn.net/horseroll/article/details/80664351