Package com.clover.sdk.v1.printer.job
Class ViewPrintJob
- java.lang.Object
-
- com.clover.sdk.v1.printer.job.PrintJob
-
- com.clover.sdk.v1.printer.job.ViewPrintJob
-
- All Implemented Interfaces:
Parcelable
- Direct Known Subclasses:
ReportPrintJob
public class ViewPrintJob extends PrintJob implements Parcelable
Create a PrintJob from a givenView
. TheViewPrintJob.Builder.build()
performs blocking IO so it must be invoked on a background thread. The View used need not be displayed on screen but it must be laid out and measured first beforehand. For that reasonViewPrintJob.Builder.view(View, int)
is now the preferred method to build an instance of this job since that method ensures layout and measurement happens. The width of the view should almost always be equal to the printer head width which can be obtained like so:PrinterConnector pc = new PrinterConnector(context, CloverAccount.getAccount(context), null); List
printerList = pc.getPrinters(Category.RECEIPT); if (printerList.size() > 0) { Printer preferredPrinter = printerList.get(0); TypeDetails typeDetails = pc.getPrinterTypeDetails(preferredPrinter); int width = typeDetails.getNumDotsWidth(); }
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ViewPrintJob.Builder
-
Nested classes/interfaces inherited from interface android.os.Parcelable
Parcelable.ClassLoaderCreator<T extends Object>, Parcelable.Creator<T extends Object>
-
-
Field Summary
Fields Modifier and Type Field Description static Parcelable.Creator<ViewPrintJob>
CREATOR
ArrayList<String>
imageFiles
For internal use only.-
Fields inherited from class com.clover.sdk.v1.printer.job.PrintJob
FLAG_BILL, FLAG_CUSTOMER, FLAG_EXPEDITOR, FLAG_FORCE_SIGNATURE, FLAG_FORCE_TIP, FLAG_MERCHANT, FLAG_NO_SIGNATURE, FLAG_NO_TIP, FLAG_NONE, FLAG_REFUND, FLAG_REPRINT, FLAG_SALE, FLAG_UNLABELED_ITEMS, FLAG_USE_PRINT_GROUP, flags, printToAny
-
Fields inherited from interface android.os.Parcelable
CONTENTS_FILE_DESCRIPTOR, PARCELABLE_WRITE_RETURN_VALUE
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
ViewPrintJob(Parcel in)
protected
ViewPrintJob(View view, int flags)
Deprecated.protected
ViewPrintJob(ViewPrintJob.Builder builder)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Category
getPrinterCategory()
void
print(Context context, Account account, Printer printer)
Send this PrintJob to the specified printer.void
writeToParcel(Parcel dest, int flags)
-
Methods inherited from class com.clover.sdk.v1.printer.job.PrintJob
cancel, describeContents, print
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface android.os.Parcelable
describeContents
-
-
-
-
Field Detail
-
CREATOR
public static final Parcelable.Creator<ViewPrintJob> CREATOR
-
-
Constructor Detail
-
ViewPrintJob
@Deprecated protected ViewPrintJob(View view, int flags)
Deprecated.
-
ViewPrintJob
protected ViewPrintJob(ViewPrintJob.Builder builder)
-
ViewPrintJob
protected ViewPrintJob(Parcel in)
-
-
Method Detail
-
print
public void print(Context context, Account account, Printer printer)
Description copied from class:PrintJob
Send this PrintJob to the specified printer.
-
getPrinterCategory
public Category getPrinterCategory()
- Specified by:
getPrinterCategory
in classPrintJob
-
writeToParcel
public void writeToParcel(Parcel dest, int flags)
- Specified by:
writeToParcel
in interfaceParcelable
- Overrides:
writeToParcel
in classPrintJob
-
-