You can use Clover’s image print drivers to test receipts without requiring a Clover devkit. Every time you want to test with a printer receipt using the emulator, the driver saves the receipt output as a PNG file.
These drivers work only in the sandbox environment.
To set up the image print drivers:
- Install and launch your test Android app on the emulator.
- In Android Studio, select View > Tool Windows > Terminal (Alt+F12/Option+F12).
- To enable the Clover image printer drivers, enter the following command:
adb shell am startservice -n "com.clover.engine/.services.ReceiptPrinterPlugins.image.EnableImagePrintService" -a "enable"
Once enabled, the drivers can be discovered as printers using the Printers app.
- In the Printers app, select the green + button from the bottom left of the screen.
- Select Add Receipt Printer or Add Order Printer.
- From the available list, select the image printer driver you want to add. The drivers emulate the different widths of printer receipts.
To use the image print drivers, simply print a receipt for an order. The output is saved under
$ adb shell ls /sdcard/receipts ... receipt-2019-03-22_18-16-47-993-00.png receipt-2019-03-22_18-16-47-993-01.png receipt-2019-03-22_18-16-47-993-02.png
The receipt file name format is
part is the receipt part number. Receipts can be long, which is why they are printed in parts to avoid saving large images. In the sample output above, a single receipt is split into 3 parts.
To disable the Clover image printer drivers, enter the following command:
adb shell am startservice -n "com.clover.engine/.services.ReceiptPrinterPlugins.image.EnableImagePrintService" -a "disable"
Disabling the image printer drivers removes the discovery of the image printer drivers, but does not remove the image printer options that are configured for printing.
Updated 11 months ago