将Syntac ZPL字符串输入到字节后台打印程序中时出错

时间:2016-01-12 01:46:51

标签: java barcode zpl

我无法解析这种语法:

printerConnection.write(configLabel = "^FO80,160 ^BY1,2.0,180^BCN,180,Y,N,N^FD" + nor + "^FS".getBytes());//error in here

printerConnection.write(configLabel = "^FO250,400 ^A0,38,38^FD" + name + "^FS" .getBytes());//error in here

printerConnection.write(configLabel = "^XZ".getBytes())


 //its Query for input to syntax ZPL 

sql1= "SELECT  norm as a1, "
+ "name as a "
+ "from xytable"
+ "where nor ="+noRParameter+" ";
java.sql.Statement stmt=koneksi.createStatement();
java.sql.ResultSet rslt=stmt.executeQuery(sql1);
while(rslt.next()){
String nor = rslt.getString("nor");
String name = rslt.getString("name");}

我在脚本ZPL中遇到错误。它是字节但是我在字符串中得到了数据?你能帮助我吗?在此之前谢谢:)

1 个答案:

答案 0 :(得分:0)

您只在最后一个字符串上执行getBytes()方法 你需要这样的东西:

printerConnection.write(
   // Note the added parents around the String you want to execute getBytes() on.
   configLabel = ("^FO80,160 ^BY1,2.0,180^BCN,180,Y,N,N^FD" + nor + "^FS").getBytes()
);