200字范文,内容丰富有趣,生活中的好帮手!
200字范文 > JAVA 佳博热敏打印机利用TSCLIB.dll动态链接库打印物料条码

JAVA 佳博热敏打印机利用TSCLIB.dll动态链接库打印物料条码

时间:2019-08-14 00:48:43

相关推荐

JAVA 佳博热敏打印机利用TSCLIB.dll动态链接库打印物料条码

JAVA 佳博热敏打印机利用TSCLIB.dll动态链接库打印物料条码

准备

1、TSCLIB.dll (下载版本与jdk版本一致,32位/64位)

2、佳博热敏打印机一台(或其他tsc系列打印机)

TSCLIB环境配置

1、32位版本的要放置在C盘windows\system32目录下

2、64位则放在C盘windows\system64目录下

代码

下面展示一些内联代码片

<!-- 佳博打印机第三方库 --><dependency><groupId>net.java.dev.jna</groupId><artifactId>jna</artifactId><version>3.2.5</version></dependency>//加载库文件private static final String LOAD_LIBRARY="TSCLIB";//打印机型号private static final String print_model="Gprinter GP-3120TU (1)";/*** @class:TscLibDll*@descript:创建TSCLIB.dll编程接口*动态链接库TSCLIB.dll,支持大部分佳博打印机,和其他品牌的TSC系列的打印机*@date:12月8日 下午2:03:55*@version:V1.0*/public interface TscLibDll extends Library {TscLibDll INSTANCE = (TscLibDll) Native.loadLibrary ("TSCLIB", TscLibDll.class);int about ();int openport (String pirnterName);int closeport ();int sendcommand (String printerCommand);int setup (String width,String height,String speed,String density,String sensor,String vertical,String offset);int downloadpcx (String filename,String image_name);int barcode (String x,String y,String type,String height,String readable,String rotation,String narrow,String wide,String code);int printerfont (String x,String y,String fonttype,String rotation,String xmul,String ymul,String text);int clearbuffer ();int printlabel (String set, String copy);int formfeed ();int nobackfeed ();int windowsfont (int x, int y, int fontheight, int rotation, int fontstyle, int fontunderline, String szFaceName, String content);}/*** 博顿物料打印条码* @param ibdPrintDto 参数 条码 code128*/public static void printBarcode() {//加载驱动System.loadLibrary(LOAD_LIBRARY);//解决中文乱码System.setProperty("jna.encoding", "GBK");//TscLibDll.INSTANCE.about();TscLibDll.INSTANCE.openport(print_model);//TscLibDll.INSTANCE.downloadpcx("C:\\UL.PCX", "UL.PCX");//TscLibDll.INSTANCE.sendcommand("REM ***** This is a test by JAVA. *****");TscLibDll.INSTANCE.setup("40", "25", "5", "8", "0", "10", "0");TscLibDll.INSTANCE.clearbuffer();TscLibDll.INSTANCE.printerfont("13", "100", "TSS24.BF2", "0", "1", "1", "名称:");TscLibDll.INSTANCE.printerfont("13", "125", "TSS24.BF2", "0", "1", "1", "规格:");TscLibDll.INSTANCE.barcode("45", "10", "128", "64", "1", "0", "2", "2", "1223");//TscLibDll.INSTANCE.windowsfont(400, 200, 48, 0, 3, 1, "arial", "DEG 0");TscLibDll.INSTANCE.printlabel("1", ibdPrintDto.getPrintCount());TscLibDll.INSTANCE.closeport();}public static main(String args[]){printBarcode();}

相关链接

TSCLIB.DLL使用说明

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。