2015-10-09 37 views
2

目前我試圖使用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充塞,我想打印,當我的字符串緩衝區膨脹與我們 它傳遞給斑馬打印機如下的說明,

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

回答

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「。