Zebra打印机提供空白页

时间:2015-10-09 10:47:28

标签: android printing zebra-printers zpl

目前我正在尝试使用CPCL打印在线打印模式。使用mZ320打印机正确打印所有内容但是当涉及到iMz220或iMz320时,它会打印出一些东西,并且长间隙会再次打印出一些东西。差距....等等。 请专家看看我的编码风格(使用CPCL)并告诉我我做错了什么。

                    if (printerModel.equals("3-inch")) {
              String prntFormat = "! U1 SETLP 0 2 24 " + "! U1 SETBOLD 1 "
                          + "! U1 X" + " " + x + " " + "! U1 Y" + " " + y + " "
                          + strValue;

              strBuff = strBuff.append(prntFormat);
               }

上面我们正在附加strBuff和我想要打印的打印内容,当我的字符串缓冲区按照我们的说明进行充气时 将它传递给zebra打印机如下,

        try {
            zebraPrinterConnection.write(strBuff.toString().getBytes());
        } catch (ZebraPrinterConnectionException e) {
            e.printStackTrace();
        }

1 个答案:

答案 0 :(得分:0)

而不是使用代码

if (printerModel.equals("3-inch")) {
          String prntFormat = "! U1 SETLP 0 2 24 " + "! U1 SETBOLD 1 "
                      + "! U1 X" + " " + x + " " + "! U1 Y" + " " + y + " "
                      + strValue;

          strBuff = strBuff.append(prntFormat);
           }

我们需要写

String prntformat ="! 0 200 200 45 1 T 5 0 10 15" + strValue +" PRINT \ r \ n"。