| CustomiOSApi 1.09

Public Types | Instance Methods | List of all members
CustomPrinter Class Reference

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

`#import <CustomPrinter.h>`

## Public Types
enum | CommPortType { COMMTYPE_BLUETOOTH = 0 , COMMTYPE_WIFI = 1 , COMMTYPE_BLE = 2 , 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...
(CustomPrinterStatus *) | - 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:msecs:
| Sets the Timeout for Communication Port Read More...
(NSInteger) | - GetWriteTimeout:
| Returns the Timeout for Communication Port Write More...
(void) | - SetWriteTimeout:msecs:
| 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:data:
| Write Data Buffer to printer More...
(void) | - Feed:nFeeds:
| Sends Feeds to the printer More...
(void) | - Cut:cutType:
| Sends a Cut command to the printer More...
(void) | - Eject:ejectType:
| Sends a Eject command to the printer More...
(void) | - Present:presentMM:
| Sends a present command to the printer More...
(void) | - PrintText:text:pixel_la:pixel_w:font:
(void) | - PrintTextLF:text:pixel_la:pixel_w:font:
| Sends the text data to printer to print and adds a LF at the end More...
(void) | - PrintText:text:font:
| Sends the text data to printer to print. It will print data on full page width with 0 margin More...
(void) | - PrintTextLF:text:font:
| 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) | - PrintTextArrayLF:textarray:font:
| 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:text:
| 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:text:
| 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) | - PrintTextArrayLF:textarray:
| 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:image:leftAlign:widthOption:imgWidth:
| Sends the Bitmap data to printer to print More...
(void) | - PrintImage:image:
| Sends the Bitmap data to printer to print fit to paper width More...
(void) | - PrintBarcodeText:brcText:brcType:brcHriType:brcJustification:brcWidth:brcHeight:
| Sends barcode Text to printer to print More...
(void) | - PrintBarcodeData:brcData:brcType:brcHriType:brcJustification:brcWidth:brcHeight:
| Sends barcode data to printer to print More...
(void) | - PrintBarcode2DText:brcText:brcType:brcJustification:brcWidth:
| Sends barcode 2D Text to printer to print More...
(void) | - PrintBarcode2DData:brcData:brcType:brcJustification:brcWidth:
| 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

## ◆ Barcode2DType

- (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

## ◆ BarcodeHriType

- (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

## ◆ BarcodeJustification

- (enum) BarcodeJustification

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

## ◆ BarcodeType

- (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

## ◆ CommPortType

- (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_BLE | Indicates that the communication port is a BLE (Bluetooh Low Energy)
COMMTYPE_NONE | Indicates that the communication port isn't init

## ◆ CutType

- (enum) CutType

Cut Type

Enumerator
CUT_TOTAL | Indicates to perform a Total Cut
CUT_PARTIAL | Indicates to perform a Partial Cut

## ◆ EjectType

- (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

## ◆ ImageJustification

- (enum) ImageJustification

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

## ◆ ImageScale

- (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

## ◆ ClearReadBuffer:

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

Clears the Read Buffer of Communication Port

Parameters

  error | Error pointer

## ◆ Close:

- (void) Close: |  | (NSError**) | error |

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

Parameters

  error | Error pointer

## ◆ Cut:cutType:

- (void) Cut: |  | (enum CutType) |
cutType: |  | (NSError**) | error

Sends a Cut command to the printer

Parameters

  cutType | Cut Type: CUT_TOTAL - Perform a Total Cut. CUT_PARTIAL - Perform a Partial Cut.
  error | Error pointer

## ◆ Eject:ejectType:

- (void) Eject: |  | (enum EjectType) |
ejectType: |  | (NSError**) | error

Sends a Eject command to the printer

Parameters

  ejectType | Eject type: EJ_EJECT - Perform a Eject or feeds to tear-off postion. EJ_RECTRACT - Perform a Retract.
  error | Error pointer

## ◆ Feed:nFeeds:

- (void) Feed: |  | (NSInteger) |
nFeeds: |  | (NSError**) | error

Sends Feeds to the printer

Parameters

  error | Error pointer
  nFeeds | Number of LF to send

## ◆ GetAPIVersion

- (NSString *) GetAPIVersion |  |  |

Returns current API version

Returns
  current API version

## ◆ GetFirmwareVersion:

- (NSString *) GetFirmwareVersion: |  | (NSError**) | error |

Returns the printer FW Release

Parameters

  error | Error pointer

Returns
  Returns the printer FW Release

## ◆ GetPageWidth

- (NSInteger) GetPageWidth |  |  |

Returns the max printable width in pixels / dots

Returns
  Returns the max printable width in pixels / dots

## ◆ GetPortType

- (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.

## ◆ GetPrinterFullStatus:

- (CustomPrinterStatus *) GetPrinterFullStatus: |  | (NSError**) | error |

Returns the status of the printer

Parameters

  error | Error pointer

Returns
  Returns the status of the printer

## ◆ GetPrinterFullStatusBuffer:

- (NSData *) GetPrinterFullStatusBuffer: |  | (NSError**) | error |

Returns the status of the printer

Parameters

  error | Error pointer

Returns
  Returns the status of the printer. See the printer manual to understand the bit mask

## ◆ GetPrinterId:

- (NSInteger) GetPrinterId: |  | (NSError**) | error |

Returns the printer ID

Parameters

  error | Error pointer

Returns
  Returns the printer ID

## ◆ GetPrinterName

- (NSString *) GetPrinterName |  |  |

Returns name/type of the Printer

Returns
  Returns name/type of the Printer

## ◆ GetReadTimeout:

- (NSInteger) GetReadTimeout: |  | (NSError**) | error |

Returns the Timeout for Communication Port Read

Parameters

  error | Error pointer

Returns
  Timeout for Communication Port Read(msec)

## ◆ GetWriteTimeout:

- (NSInteger) GetWriteTimeout: |  | (NSError**) | error |

Returns the Timeout for Communication Port Write

Parameters

  error | Error pointer

Returns
  Timeout for Communication Port Write(msec)

## ◆ IsPrinterOnline:

- (Boolean) IsPrinterOnline: |  | (NSError**) | error |

Returns if the printer is ready or not

Parameters

  error | Error pointer

Returns
  Returns if the printer is ready or not

## ◆ Present:presentMM:

- (void) Present: |  | (NSInteger) |
presentMM: |  | (NSError**) | error

Sends a present command to the printer

Parameters

  presentMM | mm of paper to present
  error | Error pointer

## ◆ PrintBarcode2DData:brcData:brcType:brcJustification:brcWidth:

- (void) PrintBarcode2DData: |  | (NSData*) |
brcData: |  | (enum Barcode2DType) |
brcType: |  | (enum BarcodeJustification) |
brcJustification: |  | (NSInteger) |
brcWidth: |  | (NSError**) | error

Sends barcode 2D data to printer to print

Parameters

  brcData | Barcode Data
  brcType | Barcode 2D Type
  brcJustification | Barcode Justification
  brcWidth | Barcode Width
  error | Error pointer

## ◆ PrintBarcode2DText:brcText:brcType:brcJustification:brcWidth:

- (void) PrintBarcode2DText: |  | (NSString*) |
brcText: |  | (enum Barcode2DType) |
brcType: |  | (enum BarcodeJustification) |
brcJustification: |  | (NSInteger) |
brcWidth: |  | (NSError**) | error

Sends barcode 2D Text to printer to print

Parameters

  brcText | Barcode Text
  brcType | Barcode 2D Type
  brcJustification | Barcode Justification
  brcWidth | Barcode Width
  error | Error pointer

## ◆ PrintBarcodeData:brcData:brcType:brcHriType:brcJustification:brcWidth:brcHeight:

- (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

  brcData | Barcode Data
  brcType | Barcode Type
  brcHriType | Barcode HRI (Human Readable Information) Type
  brcJustification | Barcode Justification
  brcWidth | Barcode Width (referred to the narrow bar)
  brcHeight | Barcode Height
  error | Error pointer

## ◆ PrintBarcodeText:brcText:brcType:brcHriType:brcJustification:brcWidth:brcHeight:

- (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

  brcText | Barcode Text
  brcType | Barcode Type
  brcHriType | Barcode HRI (Human Readable Information) Type
  brcJustification | Barcode Justification
  brcWidth | Barcode Width (referred to the narrow bar)
  brcHeight | Barcode Height
  error | Error pointer

## ◆ PrintImage:image:

- (void) PrintImage: |  | (UIImage*) |
image: |  | (NSError**) | error

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

Parameters

  image | Bitmap image to print
  error | Error pointer

## ◆ PrintImage:image:leftAlign:widthOption:imgWidth:

- (void) PrintImage: |  | (UIImage*) |
image: |  | (NSInteger) |
leftAlign: |  | (enum ImageScale) |
widthOption: |  | (NSInteger) |
imgWidth: |  | (NSError**) | error

Sends the Bitmap data to printer to print

Parameters

  image | Bitmap image to print
  leftAlign | If 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.
  widthOption | Scaling 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.
  imgWidth | Printed Image width in pixel / dots (used only if widthOption=IMAGE_SCALE_TO_WIDTH)
  error | Error pointer

## ◆ PrintText:text:

- (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

  text | String to print
  error | Error pointer

## ◆ PrintText:text:font:

- (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

  text | String to print
  font | Holds various font attributes
  error | Error pointer

## ◆ PrintText:text:pixel_la:pixel_w:font:

- (void) PrintText: |  | (NSString*) |
text: |  | (NSInteger) |
pixel_la: |  | (NSInteger) |
pixel_w: |  | (PrinterFont*) |
font: |  | (NSError**) | error

Sends the text data to printer to print

Parameters

  text | String to print
  pixel_la | Left align in pixel
  pixel_w | Print area width in pixel. Pass -1 to use max available print width
  font | Holds various font attributes
  error | Error pointer

## ◆ PrintTextArrayLF:textarray:

- (void) PrintTextArrayLF: |  | (NSArray*) |
textarray: |  | (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

  textarray | Array of Strings to print
  error | Error pointer

## ◆ PrintTextArrayLF:textarray:font:

- (void) PrintTextArrayLF: |  | (NSArray*) |
textarray: |  | (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

  textarray | Array of Strings to print
  font | Holds various font attributes
  error | Error pointer

## ◆ PrintTextLF:text:

- (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

  text | String to print
  error | Error pointer

## ◆ PrintTextLF:text:font:

- (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

  text | String to print
  font | Holds various font attributes
  error | Error pointer

## ◆ PrintTextLF:text:pixel_la:pixel_w:font:

- (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

  text | String to print
  pixel_la | Left align in pixel
  pixel_w | Print area width in pixel. Pass -1 to use max available print width
  font | Holds various font attributes
  error | Error pointer

## ◆ ReadData:

- (NSData *) ReadData: |  | (NSError**) | error |

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

Parameters

  error | Error pointer

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

## ◆ SetReadTimeout:msecs:

- (void) SetReadTimeout: |  | (NSInteger) |
msecs: |  | (NSError**) | error

Sets the Timeout for Communication Port Read

Parameters

  error | Error pointer
  msecs | Timeout for Communication Port Read(msec)

## ◆ SetWriteTimeout:msecs:

- (void) SetWriteTimeout: |  | (NSInteger) |
msecs: |  | (NSError**) | error

Sets the Timeout for Communication Port Write

Parameters

  error | Error pointer
  msecs | Timeout for Communication Port Write(msec)

## ◆ WriteData:data:

- (void) WriteData: |  | (NSData *) |
data: |  | (NSError**) | error

Write Data Buffer to printer

Parameters

  error | Error pointer
  data | Data Buffer to write to the printer