Zebra 打印机送入空白页

Zebra printer feeds blank page

目前我正在尝试使用 CPCL.Everything 以行打印模式进行打印,使用 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 中附加了我想要打印的打印内容,当我的字符串缓冲区用我们的指令膨胀时 按如下方式将其传递给斑马打印机,

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

而不是使用代码

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);
           }

我们需要写

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