CustomiOSApi  1.04
 All Classes Functions Enumerations Enumerator Pages
CustomPrinter Class Reference

Class definition for CUSTOM printers. Defines functionality to print text/image, read/write data to printer, etc More...

Public Types

enum  CommPortType { COMMTYPE_BLUETOOTH = 0, COMMTYPE_WIFI = 1, COMMTYPE_NONE = 0xFF }
 Communication Port Type More...
 
enum  ImageScale { IMAGE_SCALE_NONE = 0, IMAGE_SCALE_TO_FIT = 1, IMAGE_SCALE_TO_WIDTH = 2 }
 Print Image Scale More...
 
enum  ImageJustification { IMAGE_ALIGN_TO_LEFT = 0, IMAGE_ALIGN_TO_CENTER = -1, IMAGE_ALIGN_TO_RIGHT = -2 }
 Print Image Justification / Left Position More...
 
enum  CutType { CUT_TOTAL = 0, CUT_PARTIAL = 1 }
 Cut Type More...
 
enum  EjectType { EJ_EJECT = 0, EJ_RETRACT = 1 }
 Eject Type More...
 
enum  BarcodeType {
  BARCODE_TYPE_CODABAR = -1, BARCODE_TYPE_UPCA = -2, BARCODE_TYPE_UPCE = -3, BARCODE_TYPE_EAN13 = -4,
  BARCODE_TYPE_EAN8 = -5, BARCODE_TYPE_CODE39 = -6, BARCODE_TYPE_ITF = -7, BARCODE_TYPE_CODE93 = -8,
  BARCODE_TYPE_CODE128 = -9, BARCODE_TYPE_CODE32 = -10
}
 Barcode Type More...
 
enum  Barcode2DType {
  BARCODE_TYPE_QRCODE = -101, BARCODE_TYPE_MICROQRCODE = -102, BARCODE_TYPE_DATAMATRIX = -103, BARCODE_TYPE_PDF417 = -104,
  BARCODE_TYPE_MICROPDF417 = -105, BARCODE_TYPE_AZTEC = -106
}
 Barcode 2D Type More...
 
enum  BarcodeHriType { BARCODE_HRI_NONE = 0, BARCODE_HRI_TOP = 1, BARCODE_HRI_BOTTOM = 2, BARCODE_HRI_TOPBOTTOM = 3 }
 Barcode HRI Type More...
 
enum  BarcodeJustification { BARCODE_ALIGN_TO_LEFT = 0, BARCODE_ALIGN_TO_CENTER = -1, BARCODE_ALIGN_TO_RIGHT = -2 }
 Barcode Print Justification / Left Position More...
 

Instance Methods

(Boolean) - IsPrinterOnline:
 Returns if the printer is ready or not More...
 
(NSInteger) - GetPrinterId:
 Returns the printer ID More...
 
(NSString *) - GetFirmwareVersion:
 Returns the printer FW Release More...
 
(NSString *) - GetAPIVersion
 Returns current API version More...
 
(NSData *) - GetPrinterFullStatusBuffer:
 Returns the status of the printer More...
 
(PrinterStatus *) - GetPrinterFullStatus:
 Returns the status of the printer More...
 
(NSString *) - GetPrinterName
 Returns name/type of the Printer More...
 
(NSInteger) - GetPageWidth
 Returns the max printable width in pixels / dots More...
 
(NSInteger) - GetReadTimeout:
 Returns the Timeout for Communication Port Read More...
 
(void) - SetReadTimeout::
 Sets the Timeout for Communication Port Read More...
 
(NSInteger) - GetWriteTimeout:
 Returns the Timeout for Communication Port Write More...
 
(void) - SetWriteTimeout::
 Sets the Timeout for Communication Port Write More...
 
(void) - Close:
 Disconnect the link, close the communication port and release attached resources More...
 
(enum CommPortType- GetPortType
 Returns the communication port type More...
 
(void) - ClearReadBuffer:
 Clears the Read Buffer of Communication Port More...
 
(NSData *) - ReadData:
 Read Data Buffer from printer. It will return all available data in buffer More...
 
(void) - WriteData::
 Write Data Buffer to printer More...
 
(void) - Feed::
 Sends Feeds to the printer More...
 
(void) - Cut::
 Sends a Cut command to the printer More...
 
(void) - Eject::
 Sends a Eject command to the printer More...
 
(void) - Present::
 Sends a present command to the printer More...
 
(void) - PrintText:::::
 
(void) - PrintTextLF:::::
 Sends the text data to printer to print and adds a LF at the end More...
 
(void) - PrintText:::
 Sends the text data to printer to print. It will print data on full page width with 0 margin More...
 
(void) - PrintTextLF:::
 Sends the text data to printer to print and adds a LF at the end. It will print data on full page width with 0 margin More...
 
(void) - PrintText::
 Sends the text data to printer to print. It will print data on full page width with 0 margin using the last font attributes More...
 
(void) - PrintTextLF::
 Sends the text data to printer to print and adds a LF at the end. It will print data on full page width with 0 margin using the last font attributes More...
 
(void) - PrintImage:::::
 Sends the Bitmap data to printer to print More...
 
(void) - PrintImage::
 Sends the Bitmap data to printer to print fit to paper width More...
 
(void) - PrintBarcodeText:::::::
 Sends barcode Text to printer to print More...
 
(void) - PrintBarcodeData:::::::
 Sends barcode data to printer to print More...
 
(void) - PrintBarcode2DText:::::
 Sends barcode 2D Text to printer to print More...
 
(void) - PrintBarcode2DData:::::
 Sends barcode 2D data to printer to print More...
 

Detailed Description

Class definition for CUSTOM printers. Defines functionality to print text/image, read/write data to printer, etc

Member Enumeration Documentation

- (enum) Barcode2DType

Barcode 2D Type

Enumerator
BARCODE_TYPE_QRCODE 

Indicates to print a QRCODE 2D Barcode

BARCODE_TYPE_MICROQRCODE 

Indicates to print a MICROQRCODE 2D Barcode

BARCODE_TYPE_DATAMATRIX 

Indicates to print a DATAMATRIX 2D Barcode

BARCODE_TYPE_PDF417 

Indicates to print a PDF417 2D Barcode

BARCODE_TYPE_MICROPDF417 

Indicates to print a MICROPDF417 2D Barcode

BARCODE_TYPE_AZTEC 

Indicates to print a AZTEC 2D Barcode

- (enum) BarcodeHriType

Barcode HRI Type

Enumerator
BARCODE_HRI_NONE 

Indicates no HRI on the Barcode

BARCODE_HRI_TOP 

Indicates HRI on TOP of the Barcode

BARCODE_HRI_BOTTOM 

Indicates HRI on BOTTOM of the Barcode

BARCODE_HRI_TOPBOTTOM 

Indicates HRI on TOP and BOTTOM of the Barcode

Barcode Print Justification / Left Position

Enumerator
BARCODE_ALIGN_TO_LEFT 

Indicates that the Barcode Justification is Left

BARCODE_ALIGN_TO_CENTER 

Indicates that the Barcode Justification is Center

BARCODE_ALIGN_TO_RIGHT 

Indicates that the Barcode Justification is Right

- (enum) BarcodeType

Barcode Type

Enumerator
BARCODE_TYPE_CODABAR 

Indicates to print a CODEBAR Barcode

BARCODE_TYPE_UPCA 

Indicates to print a UPCA Barcode

BARCODE_TYPE_UPCE 

Indicates to print a UPCE Barcode

BARCODE_TYPE_EAN13 

Indicates to print a EAN13 Barcode

BARCODE_TYPE_EAN8 

Indicates to print a EAN8 Barcode

BARCODE_TYPE_CODE39 

Indicates to print a CODE39 Barcode

BARCODE_TYPE_ITF 

Indicates to print a ITF Barcode

BARCODE_TYPE_CODE93 

Indicates to print a CODE93 Barcode

BARCODE_TYPE_CODE128 

Indicates to print a CODE128 Barcode

BARCODE_TYPE_CODE32 

Indicates to print a CODE32 Barcode

- (enum) CommPortType

Communication Port Type

Enumerator
COMMTYPE_BLUETOOTH 

Indicates that the communication port is a BLUETOOTH

COMMTYPE_WIFI 

Indicates that the communication port is a WIFI

COMMTYPE_NONE 

Indicates that the communication port isn't init

- (enum) CutType

Cut Type

Enumerator
CUT_TOTAL 

Indicates to perform a Total Cut

CUT_PARTIAL 

Indicates to perform a Partial Cut

- (enum) EjectType

Eject Type

Enumerator
EJ_EJECT 

Indicates to perform a Eject or feeds to tear-off postion

EJ_RETRACT 

Indicates to perform a Retract

Print Image Justification / Left Position

Enumerator
IMAGE_ALIGN_TO_LEFT 

Indicates that the Picture Justification is Left

IMAGE_ALIGN_TO_CENTER 

Indicates that the Picture Justification is Center

IMAGE_ALIGN_TO_RIGHT 

Indicates that the Picture Justification is Right

- (enum) ImageScale

Print Image Scale

Enumerator
IMAGE_SCALE_NONE 

Indicates that the Picture will be No scaling. Excess size will be ignored

IMAGE_SCALE_TO_FIT 

Indicates that the Picture will be Scale to fit the paper width

IMAGE_SCALE_TO_WIDTH 

Indicates that the Picture will be Scale the image to width given by width parameter

Method Documentation

- (void) ClearReadBuffer: (NSError**)  error

Clears the Read Buffer of Communication Port

Parameters
errorError pointer
- (void) Close: (NSError**)  error

Disconnect the link, close the communication port and release attached resources

Parameters
errorError pointer
- (void) Cut: (enum CutType cutType
: (NSError**)  error 

Sends a Cut command to the printer

Parameters
cutTypeCut Type:
  • CUT_TOTAL - Perform a Total Cut.
  • CUT_PARTIAL - Perform a Partial Cut.
errorError pointer
- (void) Eject: (enum EjectType ejectType
: (NSError**)  error 

Sends a Eject command to the printer

Parameters
ejectTypeEject type:
  • EJ_EJECT - Perform a Eject or feeds to tear-off postion.
  • EJ_RECTRACT - Perform a Retract.
errorError pointer
- (void) Feed: (NSInteger)  nFeeds
: (NSError**)  error 

Sends Feeds to the printer

Parameters
errorError pointer
nFeedsNumber of LF to send
- (NSString *) GetAPIVersion

Returns current API version

Returns
current API version
- (NSString *) GetFirmwareVersion: (NSError**)  error

Returns the printer FW Release

Parameters
errorError pointer
Returns
Returns the printer FW Release
- (NSInteger) GetPageWidth

Returns the max printable width in pixels / dots

Returns
Returns the max printable width in pixels / dots
- (enum CommPortType) GetPortType

Returns the communication port type

Returns
Returns the communication port type
  • COMMTYPE_NONE for None.
  • COMMTYPE_BLUETOOTH for Bluetooth.
  • COMMTYPE_WIFI for Wifi/Ethernet.
- (PrinterStatus *) GetPrinterFullStatus: (NSError**)  error

Returns the status of the printer

Parameters
errorError pointer
Returns
Returns the status of the printer
- (NSData *) GetPrinterFullStatusBuffer: (NSError**)  error

Returns the status of the printer

Parameters
errorError pointer
Returns
Returns the status of the printer. See the printer manual to understand the bit mask
- (NSInteger) GetPrinterId: (NSError**)  error

Returns the printer ID

Parameters
errorError pointer
Returns
Returns the printer ID
- (NSString *) GetPrinterName

Returns name/type of the Printer

Returns
Returns name/type of the Printer
- (NSInteger) GetReadTimeout: (NSError**)  error

Returns the Timeout for Communication Port Read

Parameters
errorError pointer
Returns
Timeout for Communication Port Read(msec)
- (NSInteger) GetWriteTimeout: (NSError**)  error

Returns the Timeout for Communication Port Write

Parameters
errorError pointer
Returns
Timeout for Communication Port Write(msec)
- (Boolean) IsPrinterOnline: (NSError**)  error

Returns if the printer is ready or not

Parameters
errorError pointer
Returns
Returns if the printer is ready or not
- (void) Present: (NSInteger)  presentMM
: (NSError**)  error 

Sends a present command to the printer

Parameters
presentMMmm of paper to present
errorError pointer
- (void) PrintBarcode2DData: (NSData*)  brcData
: (enum Barcode2DType brcType
: (enum BarcodeJustification brcJustification
: (NSInteger)  brcWidth
: (NSError**)  error 

Sends barcode 2D data to printer to print

Parameters
brcDataBarcode Data
brcTypeBarcode 2D Type
brcJustificationBarcode Justification
brcWidthBarcode Width
errorError pointer
- (void) PrintBarcode2DText: (NSString*)  brcText
: (enum Barcode2DType brcType
: (enum BarcodeJustification brcJustification
: (NSInteger)  brcWidth
: (NSError**)  error 

Sends barcode 2D Text to printer to print

Parameters
brcTextBarcode Text
brcTypeBarcode 2D Type
brcJustificationBarcode Justification
brcWidthBarcode Width
errorError pointer
- (void) PrintBarcodeData: (NSData*)  brcData
: (enum BarcodeType brcType
: (enum BarcodeHriType brcHriType
: (enum BarcodeJustification brcJustification
: (NSInteger)  brcWidth
: (NSInteger)  brcHeight
: (NSError**)  error 

Sends barcode data to printer to print

Parameters
brcDataBarcode Data
brcTypeBarcode Type
brcHriTypeBarcode HRI (Human Readable Information) Type
brcJustificationBarcode Justification
brcWidthBarcode Width (referred to the narrow bar)
brcHeightBarcode Height
errorError pointer
- (void) PrintBarcodeText: (NSString*)  brcText
: (enum BarcodeType brcType
: (enum BarcodeHriType brcHriType
: (enum BarcodeJustification brcJustification
: (NSInteger)  brcWidth
: (NSInteger)  brcHeight
: (NSError**)  error 

Sends barcode Text to printer to print

Parameters
brcTextBarcode Text
brcTypeBarcode Type
brcHriTypeBarcode HRI (Human Readable Information) Type
brcJustificationBarcode Justification
brcWidthBarcode Width (referred to the narrow bar)
brcHeightBarcode Height
errorError pointer
- (void) PrintImage: (UIImage*)  image
: (NSError**)  error 

Sends the Bitmap data to printer to print fit to paper width

Parameters
imageBitmap image to print
errorError pointer
- (void) PrintImage: (UIImage*)  image
: (NSInteger)  leftAlign
: (enum ImageScale widthOption
: (NSInteger)  imgWidth
: (NSError**)  error 

Sends the Bitmap data to printer to print

Parameters
imageBitmap image to print
leftAlignIf the value is > 0, the value is the align Left align in pixel. Otherwise it can be
  • IMAGE_ALIGN_TO_LEFT - align the print to the left.
  • IMAGE_ALIGN_TO_CENTER - align the print to the center.
  • IMAGE_ALIGN_TO_RIGHT - align the print to the right.
widthOptionScaling options:
  • IMAGE_SCALE_NONE - No scaling. Excess size will be ignored.
  • IMAGE_SCALE_TO_FIT - Scale to fit the paper width (see GetPageWidth).
  • IMAGE_SCALE_TO_WIDTH - Scale the image to width given by width parameter.
imgWidthPrinted Image width in pixel / dots (used only if widthOption=IMAGE_SCALE_TO_WIDTH)
errorError pointer
- (void) PrintText: (NSString*)  text
: (NSError**)  error 

Sends the text data to printer to print. It will print data on full page width with 0 margin using the last font attributes

Parameters
textString to print
errorError pointer
- (void) PrintText: (NSString*)  text
: (PrinterFont*)  font
: (NSError**)  error 

Sends the text data to printer to print. It will print data on full page width with 0 margin

Parameters
textString to print
fontHolds various font attributes
errorError pointer
- (void) PrintText: (NSString*)  text
: (NSInteger)  pixel_la
: (NSInteger)  pixel_w
: (PrinterFont*)  font
: (NSError**)  error 

Sends the text data to printer to print

Parameters
textString to print
pixel_laLeft align in pixel
pixel_wPrint area width in pixel. Pass -1 to use max available print width
fontHolds various font attributes
errorError pointer
- (void) PrintTextLF: (NSString*)  text
: (NSError**)  error 

Sends the text data to printer to print and adds a LF at the end. It will print data on full page width with 0 margin using the last font attributes

Parameters
textString to print
errorError pointer
- (void) PrintTextLF: (NSString*)  text
: (PrinterFont*)  font
: (NSError**)  error 

Sends the text data to printer to print and adds a LF at the end. It will print data on full page width with 0 margin

Parameters
textString to print
fontHolds various font attributes
errorError pointer
- (void) PrintTextLF: (NSString*)  text
: (NSInteger)  pixel_la
: (NSInteger)  pixel_w
: (PrinterFont*)  font
: (NSError**)  error 

Sends the text data to printer to print and adds a LF at the end

Parameters
textString to print
pixel_laLeft align in pixel
pixel_wPrint area width in pixel. Pass -1 to use max available print width
fontHolds various font attributes
errorError pointer
- (NSData *) ReadData: (NSError**)  error

Read Data Buffer from printer. It will return all available data in buffer

Parameters
errorError pointer
Returns
Data Buffer from printer. It will return all available data in buffer
- (void) SetReadTimeout: (NSInteger)  msecs
: (NSError**)  error 

Sets the Timeout for Communication Port Read

Parameters
errorError pointer
msecsTimeout for Communication Port Read(msec)
- (void) SetWriteTimeout: (NSInteger)  msecs
: (NSError**)  error 

Sets the Timeout for Communication Port Write

Parameters
errorError pointer
msecsTimeout for Communication Port Write(msec)
- (void) WriteData: (NSData *)  data
: (NSError**)  error 

Write Data Buffer to printer

Parameters
errorError pointer
dataData Buffer to write to the printer