Test with printer receipt images

United States
Canada
Europe
Latin America

You can use the Clover 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.

1. Enable image print drivers

  1. Install and launch your test Android app on the Android Emulator.
  2. Open Android Studio and then open a project.
  3. From the main menu, click View > Tool Windows > Terminal. The Terminal window appears.
  4. 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"

2. Add printer drivers

Once enabled, you can search for the printer drivers from the Clover Printers app.

  1. In the Printers app, click the green + button at the bottom left of the screen.
  2. Click Add Receipt Printer or Add Order Printer.
  3. From the list of available printers, 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 in /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, so they are printed in parts to avoid saving large images. In the sample output above, a single receipt is split into three parts.

3. Disable image print drivers

When you disable the image printer drivers, it removes the discovery of the image printer drivers but does not remove the image printer options that are configured for printing.

  1. Open Android Studio and then open a project.
  2. From the main menu, click View > Tool Windows > Terminal. The Terminal window appears.
  3. 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"