我正在尝试在热敏打印机的参数打印文本中设置发票,但它显示值为空。请帮助我任何人如何以字符串参数形式生成发票作为文本。
`
PrinterService printerService = new PrinterService();
System.out.println(printerService.getPrinters());
//print some stuff. Change the printer name to your thermal printer name.
printerService.printString("POSIFLEX PP6900 PRINTER", " ****POS System**** \n"
+ "Date: "+Date+" Time: "+Time+"\n"
+ "Receipt Number: "+ReceiptNumber+"\n"
+ "---------------------------------\n"
+ "Name Qty Rate Amt\n"
+ "---------------------------------\n"
+ " "+ GetProductName(prodId)+ " "+quan+" * "+totalamt+" " +price+"\n"
+ "---------------------------------\n"
+ "Subtotal: "+GetCartAmount()+"\n"
+ "Tax: "+String.valueOf(tax)+"\n"
+ "Bonus: "+GetDiscountAmount(ReceiptNumber)+"\n"
+ "Payment: "+String.valueOf(total)+"\n"
+ "---------------------------------\n"
+ "------Served by: "+ItemSoldB+"-----\n"
);
// cut that paper!
byte[] cutP = new byte[] { 0x1d, 'V', 1 };
printerService.printBytes("POSIFLEX PP6900 PRINTER", cutP);`