0% found this document useful (0 votes)
4 views

Android POS Program Manual

Uploaded by

Kirsuba Shakaran
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

Android POS Program Manual

Uploaded by

Kirsuba Shakaran
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 16

Android POS Program Manual

v2.0.0
1. Instruction

This manual describes how to implement ESC/POS printing.Constant variable are defined in
IHR810Const class.

2. IHR810

2.1. IHR810

Constructor to create print objects.


IHR810(IDeviceConnection connection)

[Parameter]
 Connection
Connected object, available via POSConnect.createDevice(deviceType)
.

2.2. printString

This function is used for text-printing.


IHR810 printString(String data)

[Parameter]
 data
Printed text string

[Return]
this

2.3. printText

This function is used for format-specific text printing.


IHR810 printText(String data, int alignment, int attribute, int textSize)
IHR810 printTextSize(String data, int textSize)
IHR810 printTextAttribute(String data, int attribute)
IHR810 printTextAlignment(String data, int alignment)

[Parameter]
 data
Printed text string
 alignment
The alignment of the text, and the default is ALIGNMENT_LEFT
Variable Description
ALIGNMENT_LEFT Align left
ALIGNMENT_CENTER Align center
ALIGNMENT_RIGHT Align right

 attribute
This value is text attributes. It sets text attributes to print. default is FNT_DEFAULT
Variable Description
FNT_DEFAULT FontA, Set up as a standard
FNT_FONTB Set up as FontB
FNT_BOLD bold font
FNT_REVERSE Set up as reverse print attribute
FNT_UNDERLINE Set up as Underline attribute
FNT_UNDERLINE2 Set up as Bold Underline attribute
 textSize
The font size of the printed text font,default is TXT_1WIDTH|TXT_1HEIGHT
Variable(Set up width ratio) Description
TXT_1WIDTH Set up width ratio as x1
TXT_2WIDTH Set up width ratio as x2
TXT_3WIDTH Set up width ratio as x3
TXT_4WIDTH Set up width ratio as x4
TXT_5WIDTH Set up width ratio as x5
TXT_6WIDTH Set up width ratio as x6
TXT_7WIDTH Set up width ratio as x7
TXT_8WIDTH Set up width ratio as x8

Variable(Set up height ratio) Description


TXT_1HEIGHT Set up height ratio as x1
TXT_2HEIGHT Set up height ratio as x2
TXT_3HEIGHT Set up height ratio as x3
TXT_4HEIGHT Set up height ratio as x4
TXT_5HEIGHT Set up height ratio as x5
TXT_6HEIGHT Set up height ratio as x6
TXT_7HEIGHT Set up height ratio as x7
TXT_8HEIGHT Set up height ratio as x8

[Return]
this
2.4. printBitmap

This function is used for printing image files.


IHR810 printBitmap(String bitmapPath, int alignment, int width)
IHR810 printBitmap(String bitmapPath, int alignment, int width, int model)
IHR810 printBitmap(Bitmap bmp, int alignment, int width)
IHR810 printBitmap(Bitmap bmp, int alignment, int width, int model)

[Parameter]
 bitmapPath
with full path of bitmap file.
 bmp
Android Bitmap Object.
 alignment
The alignment mode of the pictures.
Variable Description
ALIGNMENT_LEFT Align left
ALIGNMENT_CENTER Align center
ALIGNMENT_RIGHT Align right
 width
Print the picture width, which can be used to zoom the picture
 model
Print mode
Variable Description
BMP_NORMAL Original(Normal) size
BMP_WIDTH_DOUBLE Double width
BMP_HEIGHT_DOUBLE Double height
BMP_WIDTH_HEIGHT_DOUBLE Double size

[Return]
this

2.5. printBarCode

This function is used for supporting barcode printing.


IHR810 printBarCode(String data, int codeType)
IHR810 printBarCode(String data, int codeType, int width, int height, int alignment)
IHR810 printBarCode(String data, int codeType, int width, int height, int alignment, int
textPosition)

[Parameter]
 data
Barcode string to be printed
 codeType
Barcode type
Variable Description
BCS_UPCA UPC A
BCS_UPCE UPCE
BCS_EAN8 EAN-8
BCS_EAN13 EAN-13
BCS_JAN8 JAN-8
BCS_JAN13 JAN-13
BCS_ITF ITF
BCS_Codabar Codabar
BCS_Code39 Code 39
BCS_Code93 Code 93
BCS_Code128 Code 128, For this type, the data must be
added with {A, {B, {C, etc

 height
Barcode height, range [1,255].Default is 162
 width
This values barcode width in Dot Units, range [2, 6], Default is 3
 Alignment
It sets barcode alignment, Default is ALIGNMENT_CENTER
Variable Description
ALIGNMENT_LEFT Align left
ALIGNMENT_CENTER Align center
ALIGNMENT_RIGHT Align right

 textPosition
This value is printing position of barcode HRI letters(barcode data).Default is HRI_TEXT_BELOW.
Variable Description
HRI_TEXT_NONE Do not print barcode data
HRI_TEXT_ABOVE Print barcode data above the barcode
HRI_TEXT_BELOW Print barcode data below the barcode
HRI_TEXT_BOTH Print barcode data top and bottom

[Return]
this
2.6. feed

This function is used for sending feeding command to printer.


IHR810 feedLine(int lineCount)
IHR810 feedLine()
IHR810 feedDot(int dotCount)

[Parameter]
 lineCount
This value is the number of lines for line feeding. Default is 1
 dotCount
This value is the number of point for line feeding.

[Return]
this

2.7. printQRCode

This function is used for supporting QRCode barcode printing.


IHR810 printQRCode(String data)
IHR810 printQRCode(String data, int alignment)
IHR810 printQRCode(String data, int moduleSize, int alignment)
IHR810 printQRCode(String data, int moduleSize, int ecLevel, int alignment)

[Parameter]
 data
QRCode data to print
 moduleSize
Module size. Range[1, 16], Default is 8.
 ecLevel
Error Correction Level, Default is QRCODE_EC_LEVEL_L
Variable Description
QRCODE_EC_LEVEL_L Error correction Level L (7%)
QRCODE_EC_LEVEL_M Error correction Level M (15%)
QRCODE_EC_LEVEL_Q Error correction Level Q (25%)
QRCODE_EC_LEVEL_H Error correction Level H (30%)
 alignment
It sets QRCode alignment, Default is ALIGNMENT_CENTER
Variable Description
ALIGNMENT_LEFT Align left
ALIGNMENT_CENTER Align center
ALIGNMENT_RIGHT Align right

[Return]
this

2.8. cutPaper

This method is used for cutting the paper


IHR810 cutPaper()
IHR810 cutPaper(int model)
IHR810 cutHalfAndFeed(int distance)
Feed paper distance,and half cut paper.

[Parameter]
 model
Cut paper mode, Default is CUT_HALF.
Variable Description
CUT_ALL Full cut
CUT_HALF Half cut
 distance
Feed distance

[Return]
this

2.9. openCashBox

Open a cash drawer.


IHR810 openCashBox(int pinNum)
IHR810 openCashBox(int pinNum, int onTime, int offTime)

[Parameter]
 pinNum
Pin number to generate pulse.
Variable Description
PIN_TWO PIN 2
PIN_FIVE PIN 5

 onTime
Start tiime to generate pulse. onTime*2ms, range [0,255], Default is 30
 offTime
Stop time to generate pulse. offTime*2ms, range [0,255], Default is 255

[Return]
this

2.10. setCharSet

Set character encoding,Default is “gbk”


void setCharSet(String charSet)

[Parameter]
 charSet
Character set name.

2.11. setTextStyle

This function is used for set the font style.


IHR810 setTextStyle(int attribute, int textSize)

[Parameter]
 attribute
This value is text attributes. It sets text attributes to print. default is FNT_DEFAULT
Variable Description
FNT_DEFAULT FontA, Set up as a standard
FNT_FONTB Set up as FontB
FNT_BOLD bold font
FNT_REVERSE Set up as reverse print attribute
FNT_UNDERLINE Set up as Underline attribute
FNT_UNDERLINE2 Set up as Bold Underline attribute
 textSize
The font size of the printed text font,default is TXT_1WIDTH|TXT_1HEIGHT
Variable(Set up width ratio) Description
TXT_1WIDTH Set up width ratio as x1
TXT_2WIDTH Set up width ratio as x2
TXT_3WIDTH Set up width ratio as x3
TXT_4WIDTH Set up width ratio as x4
TXT_5WIDTH Set up width ratio as x5
TXT_6WIDTH Set up width ratio as x6
TXT_7WIDTH Set up width ratio as x7
TXT_8WIDTH Set up width ratio as x8

Variable(Set up height ratio) Description


TXT_1HEIGHT Set up height ratio as x1
TXT_2HEIGHT Set up height ratio as x2
TXT_3HEIGHT Set up height ratio as x3
TXT_4HEIGHT Set up height ratio as x4
TXT_5HEIGHT Set up height ratio as x5
TXT_6HEIGHT Set up height ratio as x6
TXT_7HEIGHT Set up height ratio as x7
TXT_8HEIGHT Set up height ratio as x8

[Return]
this

2.12. setAlignment

This method is used for set up the alignment of the text


IHR810 setAlignment(int alignment)

[Parameter]
 alignment
The alignment of the text, and the default is ALIGNMENT_LEFT
Variable Description
ALIGNMENT_LEFT Align left
ALIGNMENT_CENTER Align center
ALIGNMENT_RIGHT Align right

[Return]
this

2.13. printerCheck

This function is used for query all of the printer states.


void printerCheck(int type, int timeout, IDataCallback callback)

[Parameter]
 type
Variable Description
STS_TYPE_PRINT Print state
STS_TYPE_OFFLINE off-line state
STS_TYPE_ERR Error state
STS_TYPE_PAPER Transfer paper state

 timeout
Receive timeout, Unit is ms
 callback
Read the data callback, the callback content is the corresponding printer state, if the data is not
received in the timeout time, then the empty byte is returned.
public interface IDataCallback {
void receive(byte[] data);
}

2.14. printerStatus

This method is used to query the common state of the printer, Timeout time is 5000ms
void printerStatus(IStatusCallback callback)

[Parameter]
 callback
Read the status callback.
public interface IStatusCallback {
void receive(int status);
}
The status-values are shown in the table below.
STS_UNKNOWN Unknown state, read data timeout or received
data length is not 1
STS_NORMAL The printer is normal
STS_COVEROPEN Cover open
STS_PAPEREMPTY Printer lack of paper

2.15. cashBoxCheck

This method is used to query the cash drawer status.


void cashBoxCheck(IStatusCallback callback)

[Parameter]
 callback
Read the status callback.
public interface IStatusCallback {
void receive(int status);
}
The status-values are shown in the table below.
STS_UNKNOWN Unknown state, read data timeout or received
data length is not 1.
STS_CASH_OPEN Cash drawer is open.
STS_CASH_CLOSE Cash drawer is close.

2.16. setPrintArea

Set up the print area in page mode.


IHR810 setPrintArea(int x, int y, int width, int height)
IHR810 setPrintArea(int width, int height)

[Parameter]
 x
The x-coordinate of the starting position,Default is 0.
 y
The y-coordinate of the starting position,Default is 0.
 width
Width of printing area.
 height
Height of printing area.

[Return]
this

2.17. setPageModel

Change to page mode or standard mode.


IHR810 setPageModel(boolean isOpen)

[Parameter]
 isOpen
Enable or Disable page mode. (TRUE, FALSE)

[Return]
this
2.18. printPageModelData

Print and return to standard mode in page mode.


IHR810 printPageModelData()

[Return]
this

2.19. setPrintDirection

Select print direction in page mode.


IHR810 setPrintDirection(int direction)

[Parameter]
 direction
Print direction
Variable Description
DIRECTION_LEFT_TOP From top left to right
DIRECTION_LEFT_BOTTOM From bottom left to top
DIRECTION_RIGHT_BOTTOM From bottom right to top
DIRECTION_RIGHT_TOP From top right to bottom

[Return]
this

2.20. setAbsoluteHorizontal

Set absolute horizontal print position . (X axis)


IHR810 setAbsoluteHorizontal(int position)

[Parameter]
 position
Starting position.

[Return]
this
2.21. setRelativeHorizontal

Set relative horizontal print position. (X axis)


IHR810 setRelativeHorizontal(int position)

[Parameter]
 position
Starting position.

[Return]
this

2.22. setAbsoluteVertical

Set absolute vertical print position in page mode. (Y axis)


IHR810 setAbsoluteVertical(int position)

[Parameter]
 position
Starting position.

[Return]
this

2.23. setRelativeVertical

Set relative vertical print position in page mode. (Y axis)


IHR810 setRelativeVertical(int position)

[Parameter]
 position
Starting position.

[Return]
this

2.24. downloadNVImage

This function is used for save the NV images in flash.


IHR810 downloadNVImage(String imagePaths, int imageWidth)
IHR810 downloadNVImage(List<Bitmap> bitmaps, int imageWidth)

[Parameter]
 imagePaths
It sets the absolute path of the image files.
‘,’ = separator
(Example: "/storage/emulated/0/tmp/logo1.bmp,/storage/emulated/0/tmp/logo2.bmp")
 bitmaps
The bitmap list
 imageWidth
This value is image width.

[Return]
this

2.25. printNVImage

This function is used to support the Bitmap Image printing stored in Flash Memory.
IHR810 printNVImage(int index, int model)

[Parameter]
 index
It sets the index image stored in Flash Memory to print,range[1,255]
 model
Print model
Variable Description
BMP_NORMAL Normal size
BMP_WIDTH_DOUBLE Double width
BMP_HEIGHT_DOUBLE Double height
BMP_WIDTH_HEIGHT_DOUBLE Double size

[Return]
this

2.26. initializePrinter

Initialize Printer, This function clears the print buffer data.


IHR810 initializePrinter()
[Return]
this

2.27. selectBitmapModel

Select bitmap model


IHR810 selectBitmapModel(int model, byte[] bytes)

[Parameter]
 model
Bitmap model
Variable Description
SINGLE_DENSITY_8 8-point single density
DOUBLE_DENSITY_8 8-point double density
SINGLE_DENSITY_24 24-point single density
DOUBLE_DENSITY_24 24-point double density
 bytes
Bitmap byte array

[Return]
this

2.28. setLineSpacing

Set line-height
IHR810 setLineSpacing(int space)
 space
Line-height,If you want to restore to the default height, use SPACE_DEFAULT.

[Return]
this

2.29. sendData

This function is used to send data to the printer.


IHR810 sendData(byte[] data);
IHR810 sendData(List<byte[]> datas);

[Parameter]
 data
Byte array to be sent
 datas
Byte array collection to be sent

[Return]
this

You might also like