Android ZPL Program Manual
Android ZPL Program Manual
ZPL Printer
Mobile Printer
Rev. 1.113
2.1 ZPLPrinter
This is Constructor method. ZPLPrinter object select a character set using for parameter.
If do not use a parameter, default character set is ISO-8859-1.
ZPLPrinter() , ZPLPrinter(String charset) ,
ZPLPrinter(DeviceConnection connection) ,
ZPLPrinter(String charset, DeviceConnection connection)
[Parameter]
* charset
- Character set name.
* connection
- Device connection. (USBPortConnection, WiFiMultiConnection)
2.2 setCharSet
set a character set using for parameter.
If do not use a parameter, default character set is ISO-8859-1.
setCharSet(String charset) ,
[Parameter]
* charset
- Character set name.
2.3 setInternationalFont
Set a international character sets using for parameter.
setInternationalFont(int internationalFont) ,
[Parameter]
* internationalFont
- Set the international character sets.
2.4 SetupPrinter
This function is used for defining paper form.
void setupPrinter(char orientation, char mTrack, int width, int height)
[Parameter]
* width , height
Page width and height. (Dots)
2.5 SetSpeed
This method is used for adjust print speed.
void setSpeed(String speed)
[Parameter]
* speed [2-12]
- Print speed.
2.6 SetDarkness
This method is used for adjust print contrast.
void setDarkness(String darkness)
[Parameter]
* darkness [00-30]
- Density of printer.
2.7 StartPage
Define Start page. This method is used at the beginning of page.
void startPage()
[Parameter]
* quantitiy
- Number of pages.
2.9 PrintText
This method is used for printing text.
void printText(char deviceFont,char orientation,int height,int width,int x,int y,String data)
[Parameter]
* deviceFont
- Device font in printer [ FONT_A ~ FONT_H ]
* orientation
Variable Description
ROTATION_0 Print text with no rotation.
ROTATION_90 Print text with 90 rotation.
ROTATION_180 Print text with 180 rotation.
ROTATION_270 Print text with 270 rotation.
* height, width
- Set the height and width of text (Dots)
*x,y
- Set the x, y coordination of printing position.
* data
- Set the data of string to print.
[Parameter]
* filename
- Set the path of image file.
* bitmap
- Set the object of image.
* x,y
- Set the x, y coordination of printing position.
* compress
- Set the compress to use.
2.11 PrintCircle
Draw the circle.
void printCircle(int x,int y,int diameter,int thickness,char lineColor)
[Parameter]
* x, y
- Set the x, y coordination of printing position [Dots].
* diameter
- Set the diameter.
* thickness
- Set the thickness of line.
* lineColor
- Set the color of line [ B(Black), W(White) ]
2.12 PrintDiagonalLine
void printDiagonalLine(int x,int y,int width, int height, int thickness, char lineColor, char direction)
[Parameter]
* x,y
- Set the x, y coordination of diagonal line position [Dots].
2.13 PrintEllipse
Print ellipse.
void printEllipse(int x,int y,int width,int height,int thickness,char lineColor)
[Parameter]
* x,y
- Set the x, y coordination of ellipse position [Dots].
* width, height
- Set the width and height of ellipse [ Dots].
* thickness
- Set the thickness of line [2-4095]
* lineColor
- Set the color of line [ B(Black) , W(White) ]
2.14 PrintRectangle
Print rectangle
void printRectangle(int x,int y,int width,int height,int thickness,char lineColor,int rounding)
[Parameter]
* x,y
- Set the x, y coordination of rectangle position [Dots].
* width, height
- Set the width and height of rectangle (Dots)
* thickness
- Set the thickness of line [1-32000]
2.15 PrintBarcode
Print barcode.
void printBarcode(String barcodeType, ArrayList<String> barcodeProp,int x,int y,String data)
[Parameter]
* barcodeType
Variable Description Refer
BARCODE_Code11 Code 11 ^B1
BARCODE_Interleaved_2OF5 Interleaved 2 of 5 ^B2
BARCODE_Code39 Code 39 ^B3
BARCODE_Code49 Code 49 ^B4
BARCODE_PlanetCode Planet Code ^B5
BARCODE_PDF417 PDF 417 ^B7
BARCODE_EAN8 EAN 8 ^B8
BARCODE_UPCE UPC E ^B9
BARCODE_Code93 Code 93 ^BA
BARCODE_CODABLOCK CODA BLOCK ^BB
BARCODE_Code128 Code 128 ^BC
BARCODE_UPSMAXICODE UPS MAXICODE ^BD
BARCODE_EAN13 EAN 13 ^BE
BARCODE_MicroPDF417 Micro PDF ^BF
BARCODE_Industrial_2OF5 Industrial 2 of 5 ^BI
BARCODE_Standard_2OF5 Standard 2 of 5 ^BJ
BARCODE_Codabar Codabar ^BK
BARCODE_LOGMARS LogMARS ^BL
BARCODE_MSI MSI ^BM
BARCODE_Aztec Aztec ^BO
BARCODE_Plessey Plessey ^BP
BARCODE_QRCode QR Code ^BQ
BARCODE_RSS RSS ^BR
BARCODE_UPCEANEXT UPC EAN Ext ^BS
BARCODE_TLC39 TLC 39 ^BT
BARCODE_UPCA UPC A ^BU
BARCODE_DataMatrix Data Matrix ^BX
BARCODE_POSTNET POSTNET ^BZ
2.16 SetBarcodeField
Set the barcode properties.
void setBarcodeField(ArrayList<String> barcodeProp)
[Parameter]
* barcodeProp
Input below order in Arraylist.
- moduleWidth [1-10] (Dots)
- wide bar to narrow bar width ratio [2.0 - 3.0 (in 0.1 increments)]
- barcode height [10 ~ ] (Dots)
2.17 PrintPDF417
Print the PDF417 barcode.
void printPDF417(int x,int y,char orientation,int security,int numOfColumn, int numOfRow, char
truncate, String data)
[Parameter]
* x,y
- Set the x, y coordination of pdf417 barcode position [Dots].
* orientation
Variable Description
ROTATION_0 Print text with no rotation.
ROTATION_90 Print text with 90 rotation.
ROTATION_180 Print text with 180 rotation.
ROTATION_270 Print text with 270 rotation.
2.18 PrintDataMatrix
Print the DataMatrix barcode.
void printDataMatrix(int x,int y,char orientation,int quality,int cellSize, String data)
void printDataMatrix(int x,int y,char orientation,int quality,int columns, int rows, String data)
[Parameter]
* x, y
- Set the x, y coordination of datamatrix barcode position [Dots].
* orientation
Variable Description
ROTATION_0 Print text with no rotation.
ROTATION_90 Print text with 90 rotation.
ROTATION_180 Print text with 180 rotation.
ROTATION_270 Print text with 270 rotation.
2.20 directCommand
Send ZPL command to printer directly.
void directCommand(String command)
[Parameter]
* command
- Set the ZPL command to send.
[Parameter]
* textString
- Unicode which has a null-terminated string. It receives text to print as a factor.
* widthDots
- It receives the printing width value of the text to print as a factor. (Unit is dot)
* textSize
- It receives the font size value of the text to print as a factor. (Unit is point)
* printY
- Set the start y coordination of font position. (Unit is dot)
* Alignment
- This value is alignment.
Variable Description
LK_ZPL_LEFT Left alignment
LK_ZPL_CENTER Center alignment
LK_ZPL_RIGHT Right alignment
* typeface
- It receives the typeface of the android’s font as a factor.
Variable Description
SANS_SERIF SANS_SERIF font
SERIF SERIF font
MONOSPACE MONOSPACE font
* isBold
- It receives the bold of the android’s font as a factor.
* isItalic
- It receives the italic of the android’s font as a factor.
* isUnderline
- It receives the underline of the android’s font as a factor.
[Parameter]
* printX, printY
- Set the start x, y coordination of font position. (Unit is dot)
* textString
- Unicode which has a null-terminated string. It receives text to print as a factor.
* widthDots
- It receives the printing width value of the text to print as a factor. (Unit is dot)
* textSize
- It receives the font size value of the text to print as a factor. (Unit is point)
* typeface
- It receives the typeface of the android’s font as a factor.
Variable Description
SANS_SERIF SANS_SERIF font
SERIF SERIF font
MONOSPACE MONOSPACE font
* isBold
- It receives the bold of the android’s font as a factor.
* isItalic
- It receives the italic of the android’s font as a factor.
* isUnderline
- It receives the underline of the android’s font as a factor.
* rotation
Variable Description
ROTATION_0 Print text with no rotation.
ROTATION_90 Print text with 90 rotation.
ROTATION_180 Print text with 180 rotation.
ROTATION_270 Print text with 270 rotation.
[Parameter]
* filename
- Set the path of image file.
* bitmap
- Set the object of image.
* imageSavedName
- Set the name of saved image in printer’s flash memory. [1 to 8 alphanumeric characters]
[Parameter]
* imageSavedName
- Set the name of saved image in printer’s flash memory. [1 to 8 alphanumeric characters]
* x, y
- Set the start x, y coordination of font position. (Unit is dot)
* xMagnification, yMagnification
- Set the magnification factor on the x and y – axis. [1 to 10]
[Parameter]
* imageSavedName
- Set the name of saved image in printer’s flash memory. [1 to 8 alphanumeric characters]
[Parameter]
* ucToPrinter
- Set the command data.
* wLength
- Set the length of command data.
* ucFromResponse
- Set the response receive buffer from printer.
[Return value]
- Return the number of received data.
[Parameter]
* ucToPrinter
- Set the command data.
* wLength
- Set the length of command data.
2.27. printPDFFile
This function is used for printing pdf files.* Available for Android 5.0 or later.
*Notice*
The quantity part is always fixed to 1 in endPage().
If a value other than 1 is written, it will not be output normally.
2.28 PrintMultiLine
This method is used for printing Multi Line text.
void printMultiLine(char deviceFont,char orientation,int fontHeight,int fontWidth, int x, int y, int
widthDots, int line, int lineSpace, String data)
[Parameter]
* deviceFont
- Device font in printer [ FONT_A ~ FONT_H ]
* orientation
Variable Description
ROTATION_0 Print text with no rotation.
ROTATION_90 Print text with 90 rotation.
ROTATION_180 Print text with 180 rotation.
ROTATION_270 Print text with 270 rotation.
* fontHeight, fontWidth
- Set the height and width of text (Dots)
*x,y
- Set the x, y coordination of printing position.
* widthDots
- Set width of text block line(in dots)
* line
- Set maximum number of lines in text block.(1 ~ 9999).
* lineSpace
2.29 setDithering
This function is used to set the dithering type use to image.
void setDithering(int dither)
[Parameter]
* dither
- It sets the dithering type.
Variable Description
LK_BITMAP_NO_DITHER Thresholding method
LK_BITMAP_ERROR_DIFFUSION Error diffusion method
LK_BITMAP_ORDERED_DITHER Ordered dithering method