Class PrintJobsConnector

  • public class PrintJobsConnector
    extends CallConnector
    A class that encapsulates interaction with Clover's print job queue.
    See Also:
    • Constructor Detail

      • PrintJobsConnector

        public PrintJobsConnector​(Context context)
    • Method Detail

      • print

        public String print​(@NonNull
                            PrintJob printJob)
        Print a PrintJob to any configured suitable printer. A suitable printer is one where the printer's category (Printer.getCategory() matches the print job's category (PrintJob.getPrinterCategory(). If no suitable printer is configured the job is not printed and null is returned. If there are multiple suitable configured printers the order of selection is not defined. The selection is not stable; it may be different for each invocations of this method. If it is preferable to ensure a suitable printer is configured before printing call PrinterConnector.getPrinters(Category) passing PrintJob.getPrinterCategory() as the argument, and pass the explicit printer argument to print(Printer, PrintJob) instead of this method. This method is a convenience. The caller is not required to retrieve and evaluate the list of configured printers first and select one, possibly involving the user. Most merchants have at most one printer of each type (receipt, order, label, fiscal) configured. This however is not guaranteed. This method is equivalent to calling PrintJob.print(Context, Account) with PrintJob.printToAny set to true. The actual value of PrintJob.printToAny is not considered here.
        printJob - a PrintJob, the print job to print.
        a String, the print job ID or null if the print job was not queued.
      • getPrintJobIds

        public List<String> getPrintJobIds​(int state)
        Get all of the print job IDs with the given state. This is a hidden API. It is subject to change without warning. Use at your own risk. There is very little use of this outside of test / example code. In most cases callers will print, capture the return print job ID, and use getState(String) to get the state for that ID.