You are on page 1of 10

1/6

4.2 Paper feed command


4.2.1 Wrap
FormatASCII
LF
10 hex
10
16 hex
0A
Print the buffer contents, and wrap

4.2.2.Print and paper feed moving forward N-points


FormatASCII
ESC
J
N
10 hex 27
74
N
16 hex 1B
4A
N
Print the buffer contents,and paper feed N-point rows moving forward

4.2.3 Print and paper feed moving forward N-lines


Format ASCII
ESC
d
N
10 hex
27
100
N
16 hex
1B
64
N
Print the buffer contents,and paper feed moving forward N-lines

4.2.4 Print and paper feed go back N-lines


Format ASCII
ESC
j
N
10 hex
27
106
N
16 hex
1B
6A
N
Print the buffer contents,and paper feed go back N-points line

2/6

4.3 Line spacing setting command


4.3.1 Set the line spacing for N-line
Format

ASCII
10 hex
16 hex

ESC
27
1B

3
51
33

N
N
N

4.4 Typesetting command


4.4.1 Set the right limit

FormatASCII ESC
Q
N
10 hex 27
81
N
16 hex 1B
51
N
Right limit is the number of the characters that the right side cannot print.The width of
Each character calculated by character dot width+ word spacing(The actual value of each
Characters width is relative,affected by the zoom in or out command of the character);
The Value of the N should be ranged from 0 to the number of the characters that the print
Head can provide).It will equal 0after power-up or initialization.That is to see no
Right limit
4.4.2 set the left limit

FormatASCII ESC
1
N
10 hex 27
108
N
16 hex 1B
6C
N
Left limit is the number of the characters that the left side cannot print.The width of
Each character calculated by character dot width+ word spacing(The actual value of each
Characters width is relative,affected by the zoom in or out command of the character);
The Value of the N should be ranged from 0 to the number of the characters that the print
Head can provide).It will equal 0after power-up or initialization.That is to see no
Right limit

3/6

4.4.2 Setting The Alignment


Format

ESC
27
1B

ASCII
10 hex
16 hex

n=48 Left Justified


n=50 Right Justified

a
97
61

n
n
n

n=49 Center justified


n=51 Cancel alignment

The default is left-aligned

4.3.10 Print in Grayscale


Format

ASCII
ESC
2
N
10 hex
27
6D
N
16 hex
1b
6D N
The range of the value of the N is 1~20,the color of 20 is the most shallow,1 is the darkest color,the
Default is 8.Designed for the color shades problems of the different thermal paper

4.5

Character setting command


4.4.1 Transverse enlarge

FormatASCII ESC
U N
10 hex 27
85 N
16 hex 1B
55 N
The characters will be printed N times width than the normal
1=<N=<4 N( default)1.

r 2013-07-02 10:22

4/6

4.4.2 Longitudinal enlarge


FormatASCII
ESC
V
10 hex
27
86
16 hex
1B
56
The characters will be printed N times

N
N
N
width than the normal width

1=<N=<4 N(default)1

4.4.6 Enable / disable anti-white print


FormatASCII
ESC
1
N
10 hex
27
105
N
16 hex
1B
69
N
N1 Enable the anti-white printN= disable anti-white printN0 after power-up or initialization
PS:The Chinese character will be print out in white on black

4.6 Graphical print command


4.6.1 Printed dot pattern
FormatASCII
10 hex
16 hex

Highest levelD7

Lowest levelD7

ESC
27
1B

K
75
4B

ml
ml
ml

mh
mh
mh

1 2 3 4 5 6 7 8 9 101112

N1
N1
N1

N2...Ni
N2...Ni
N2...Ni

5/6

4.6.2 Print the GB barcode


FormatASCII
GS k
N d
10 hex 29 107
N d
16 hex 1D 6B
N d
N=choose the print barcode system
N

barcode

UPC-A

1
2

UPC-E
EAN-13

EAN-8

4.6.3 Set the height of the barcode


FormatASCII
GS h
10 hex 29 104
16 hex 1D 68

N
N
N

Set the height of the printing


N0255,N0 means 256 dots
Each point equal to 1/203 inch or 0.125mm in the POS88III
N(Default)160

4.7 Initialization Commands


4.7.1 Initialize Printer
FormatASCII
FS
10 hex 27
16 hex 1B

64
40

1.Development environment
Demo eclipse + Android4.2 SDK

2.The internal function of the printer


Serial NO.:/dev/ttyS2
Baud rate:115200
The printer interface command lie in SerialPrinter.jar.The process is as below:
SerialPrinter mSerialPrinter=SerialPrinter.GetSerialPrinter();
mSerialPrinter.OpenPrinter(new SerialParam(115200,"/dev/ttyS2",0),new
SerialDataHandler());
PWMControl.PrinterEnable(1); //Open the power of the printer
MainActivity.this.sleep(200);
//Delay, waiting for the printer to initialize
MainActivity.this.sleep(1000);
PWMControl.PrinterEnable(0);
mSerialPrinter.ClosePrinter();

Function
Name
Description

//Delay, waiting for the printing is finished


//Close the power of the printer

int SetPrinterPower(int enable)

Open the power of the printer

Parameter
Description

enable
0----Close the power

Return
Value

0---success
Other --Failure
Open the power of the printer,wait for 0.5s,then sent
the data.Close the printer power after 3s later than the
finish of the data sent.This is realized in the
pwmcontrol.java

Remark

1--- open the power

Function
Name

Void OpenPrinter(SerialParam param,Handler handle) throws

Description

Initialize the printer port

Parameter
Description

Exception
SerialParam:serial parameter
Handle:

Send the data received from the printer to the

handlerto solve it

Return
value

Non

Explanation

Only initialize all the printer port,will not operate the printer

Function
Name

void ClosePrinter()

Function
Description

Close all the interfaces of the printer

Parameter
Description

Non

Return
Value

Non

Explanation

Only close all the interfaces of the pinter,will not operate the printer

Function
Name

void printString(String text)

Function
Descroption

Print the text

Parameter

Text:printing the text need to be printed

Return value

Non

Function
Name

void enlargeFontSize(int x,int y)throws Exception

Function
Description

Set the font size

Parameter
Description

X: Width (value range1~4)


Y:Height (value range1~4)

Return value

Non

Function
Name

Void walkPaper(int dot)throws Exception

Function
Description

Paper feed

Parameter
Description

Dot: the paper feed dots(0~255)

Return value

Value

Function

Void setLineSpace(int space)throws Exception

Description

Set line spacing

Parameter
Description

Space: The size of the line space(0~255)

Return
Value

Non

Function
Name

Void setHighlight(boolean reverse)

Function
Description

Set the anti-white printing

Parameter
Description

Reversetrue :anti-white printing


False: Normal printing

Return
Value

Non

Function
Name

Void setGray(int gray)throws Exception

Function
Description

Set Print Grayscale

Parameter

Gray: Gray scale (1~15,1 is the darkest25 is the shallowest)

Return
Value

Non

Function
Name

Void setAlgin(int paramInt)throws Exception

Function
Description

Sets the alignment

Parameter
Description

paramInt48left justifying
49In the Middle
50Right justifying

Return
Value

Non

Explanation

Do not support at present

Function
Name

Void setBarHeight(int height)throws Exception

Function
Description

Set the height of the bar code

Parameter
Description

heightthe

Return
Value

Non

height of the bar code(0~255)

Function
Name

Void printBarCode(int type,byte[]code)throws Exception

Function
Description

Bar code printing

Parameter
Description

Type: bar code type


0:UPC-A
1:UPC-E
2:EAN-13
3:EAN-8
Codebar code

Return
Value

Non

Function
Name

Void sendLineFeed()throws Exception

Function
Description

Send wrap

Parameter

Non

Return
Value

Non

Function
Name

PrintBmp(int startx,Bitmap bitmap)

Function
Description

Print bitmaps

Parameter
Description

start x: The number of the points blank left on the left


Bitmap:the bitmaps need to been printed

Return
Value

Non

4.Other
It is realized in PwmControl.java

Function
Name

int EnableBuzze(int enable)

Function
Description

Buzzer control

Parameter
Description

enable
0----Close the buzzer

Return
Value

0---success
Other---Failure

Function
Name

int SetCameraBacklightness(int br)

Function
Description

Set the camera backlight brightness

Parameter
Description

brBacklight brightness0-255

Return Value

0---sucess
Other--Failure

1-----open the buzzer

You might also like