Test with printer receipt images

United States
Canada
Europe
Latin America

You can use Clover’s image print drivers to test receipts without requiring a Clover Dev Kit. 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.

Enable image print drivers

To set up the image print drivers:

  1. Install and launch your test Android app on the emulator.
  2. In Android Studio, select View > Tool Windows > Terminal (Alt+F12/Option+F12).
  3. 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.

  1. In the Printers app, select the green + button from the bottom left of the screen.
  2. Select Add Receipt Printer or Add Order Printer.
  3. 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, print a receipt for an order. The output is saved under /sdcard/receipts.

Sample output:

$ 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 receipt-{date}-{time}-{part}.png where 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.

Disable image print drivers

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"

📘

NOTE

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.