在查看DPL语言文档时将DPL指令发出后打印机只闪灯,不打印内容,猜测是指令问题。
之前的打印内容:
1 public void printDPL(){ 2 String cmd = "<STX>L\n" + 3 "PG\n" + 4 "SG\n" + 5 "191100000800020Honeywell Printer Testing\n" + 6 "1A63040001000101234\n" + 7 "Q0001\n" + 8 "E"; 9 ByteArrayOutputStream out = new ByteArrayOutputStream(); 10 11 try { 12 write(cmd.getBytes("gbk")); 13 } catch (IOException e) { 14 e.printStackTrace(); 15 } 16 }
在与官方技术人员沟通后发现是<STX>需要使用%02替换
public void printDPL(){ String cmd = "%02L\n" + "PG\n" + "SG\n" + "191100000800020Honeywell Printer Testing\n" + "1A63040001000101234\n" + "Q0001\n" + "E"; ByteArrayOutputStream out = new ByteArrayOutputStream(); try { write(cmd.getBytes("gbk")); } catch (IOException e) { e.printStackTrace(); } }
标签:打印机,打印,cmd,Testing,霍尼韦尔,ByteArrayOutputStream,DPL,PC42D From: https://www.cnblogs.com/caijihong/p/17000985.html