Skip to content

Latest commit

 

History

History
25 lines (22 loc) · 1.2 KB

File metadata and controls

25 lines (22 loc) · 1.2 KB

Print Example using the Clover Android SDK

Pre-requisites

General Overview

  1. Create a resource layout for the receipt
    • Add a ScrollView with a Linear Layout inside (needs to be a Scroll View to print elements off screen)
    • Give the Linear Layout an ID, this will be what we insert the receipt elements into and what we ultimately print
  2. In your print activity, inflate the layout from the last step (It has to be attached to a root in order to print)
    • Use the LayoutInflater (if printing from another activity) and attach the receipt to a viewgroup
    • Grab the whole receipt area and store it in a View
  3. Print the receipt
    • Use an AsyncTask
    • Specify the printer
    • Build the print job using ViewPrintJobBuilder and broadcast the request

Future revisions

  • Target specific printers
  • Spruce up print screen
  • Use a table layout to organize line items