What API should I use for printing a full itemized receipt?
When I use BillPrintJob
, using an order ID, I can print correctly:
BillPrintJob.Builder().orderId(orderId).build().print(context, account, printer)
When I use the static StaticReceiptPrintJob
the print service NPEs:
StaticReceiptPrintJob.Builder().order(order).build().print(context, account, printer);
Here is the NPE in the logs:
05-13 13:00:33.878 11597-11609/? D/PrinterController: Printer connect
05-13 13:00:33.881 11597-11609/? D/PrinterController: Automatic Status Back response received
05-13 13:00:33.881 11597-11609/? D/PrinterController: Status response received
05-13 13:00:33.881 11597-11609/? D/PrinterController: Returning printer status: OK
05-13 13:00:33.882 11597-11609/? D/UsbDeviceConnectionJNI: close
05-13 13:00:33.882 11597-11609/? D/PrinterController: Printer disconnect
05-13 13:00:33.969 1263-21748/? W/SeikoMini: onHandleIntent(PrinterIntentService.java:373): print failed, printer: Printer{uuid=8NHTTP59K01JM, type=SEIKO_MINI_USB, name=Mini, mac=null, ip=null, category=RECEIPT}
java.lang.NullPointerException
at com.clover.engine.services.ReceiptPrinterPlugins.ReceiptGenerator.createReceiptView(ReceiptGenerator.java:2035)
at com.clover.engine.services.ReceiptPrinterPlugins.ReceiptGenerator.createReceiptView(ReceiptGenerator.java:1599)
at com.clover.engine.services.ReceiptPrinterPlugins.seiko.SeikoMini.printReceipt(SeikoMini.java:75)
at com.clover.engine.services.PrinterIntentService.onHandleIntent(PrinterIntentService.java:302)
at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:65)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.os.HandlerThread.run(HandlerThread.java:61)
05-13 13:00:33.986 1263-21748/? I/SeikoMini: scheduleRepeat(PrinterIntentService.java:495): scheduling repeat, delaying 6250ms
I want to print a receipt with as much information on it as possible - payment, line items, modifications, customer name, phone number, address.
Thanks for any help.
Marc