About the Constructors

The Printing Java API provides two key classes, LabelPrinter and LinePrinter, for label printing and receipt printing respectively. The LabelPrinter and LinePrinter constructors are defined as:

public LabelPrinter(String aCmdAttribFilePath, String aPrinterID,
    String aPrinterURI, LabelPrinter.ExtraSettings extraSettings) throws LabelPrinterException
public LinePrinter(String aCmdAttribFilePath, String aPrinterID,
    String aPrinterURI, LinePrinter.ExtraSettings extraSettings) throws LinePrinterException

The aCmdAttribFilePath parameter may contain an absolute file path or a string. The file or string contents must conform to the commands and attributes format specified in the Printer Commands and Attributes User Guide.

The aPrinterID parameter specifies an identifier which is used to load the printer settings from the commands and attributes specified in the aCmdAttribFilePath parameter.

The aPrinterURI parameter specifies how to connect to the printer. For this release, it supports Bluetooth printing. The URI format is "bt://MacAddress" where MacAddress specifies the Bluetooth MAC address in the format of "nn:nn:nn:nn:nn:nn", where each n is a hexadecimal digit (for example, "00:06:AB:3C:25:8F").

The extraSettings parameter is required for the Android platform. The application needs to call the ExtraSettings.setContext method with a valid android.content.Context object. It can be an instance of an Android Activity class.