0% found this document useful (0 votes)
4 views18 pages

Android ZPL Program Manual

The Android Module Program Manual provides instructions and methods for developing Android applications that interface with ZPL printers. It details the ZPLPrinter class and various methods for setting character sets, printing text, images, and barcodes, as well as configuring printer settings. The manual includes parameters and descriptions for each method to facilitate effective usage in mobile application development.

Uploaded by

yavelot983
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 views18 pages

Android ZPL Program Manual

The Android Module Program Manual provides instructions and methods for developing Android applications that interface with ZPL printers. It details the ZPLPrinter class and various methods for setting character sets, printing text, images, and barcodes, as well as configuring printer settings. The manual includes parameters and descriptions for each method to facilitate effective usage in mobile application development.

Uploaded by

yavelot983
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/ 18

Android Module Program Manual

ZPL Printer
Mobile Printer
Rev. 1.113

SEWOO 1 Rev. 1.113


CONTENTS
1. Instruction.
2. Method.

SEWOO 2 Rev. 1.113


1. Instruction
This Android Module Program Manual describes the method which is exposed from Jar
package file needed in developing Android Mobile application.

SEWOO 3 Rev. 1.113


2. Method.
Defined in the ZPLPrinter Class. Constant variable are defined in ZPLConst Interface.

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]

SEWOO 4 Rev. 1.113


* orientation (Print Orientation)
Variable Description
ROTATION_0 Print text with no rotation.
ROTATION_90 Print text with 90 rotation.(counterclockwise)
ROTATION_180 Print text with 180 rotation.(counterclockwise)
ROTATION_270 Print text with 270 rotation.(counterclockwise)

* mTrack (Media Tracking)


Variable Description
SENSE_CONTINUOUS Continuous media.
SENSE_GAP Non continusous media web sensing. (Gap)
SENSE_WEB Non continuous media mark sensing. (Blackmark)

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

SEWOO 5 Rev. 1.113


2.8 EndPage
Define End page. This method is used at the end of page.
void endPage(int quantitiy)

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

2.10 PrintImage or PrintBitmap


Print Image.
void printImage(String filename, int x, int y)
void printImage(Bitmap bitmap, int x, int y)
void printImage(String filename, int x, int y, int compress)
void printImage(Bitmap bitmap, int x, int y, int compress)

SEWOO 6 Rev. 1.113


void printBitmap(String filename, int x, int y)
void printBitmap (Bitmap bitmap, int x, int y)

[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].

SEWOO 7 Rev. 1.113


* width, height
- Set the width and height of diagonal line (Dots)
* thickness
- Set the thickness of line [1-32000]
* lineColor
- Set the color of line [ B(Black) , W(White) ]
* direction
- Set the direction of line [ R(Right-Upper), L(Left-Upper) ]

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]

SEWOO 8 Rev. 1.113


* lineColor
- Set the color of line [ B(Black) , W(White) ]
* rounding
- Set the level of rounding [0-8]

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

SEWOO 9 Rev. 1.113


* barcodeProp
- Set the barcode properties. See the SetBarocdeFiled() function.
- Reference to ZPL Command & Barcode Type Table
* x, y
- Set the x, y coordination of barcode position [Dots].
* data
- Set the barcode data to print.

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.

SEWOO 10 Rev. 1.113


* security [1-8]
- Security level (error detection and correction).
* numOfColumn [1-30]
- Number of data columns to encode.
* numOfRow [3-90]
- Number of data rows to encode.
* truncate [Y, N]
- Truncate right row indicators and stop pattern.
* data
- Set the pdf417 barcode data to print.

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.

* quality [0, 50, 80, 100, 140, 200]


- Quality Level
* cellSize[2-20]
- Set the cell size
* columns [9-49]
- Columns to encode (odd value(Quality 0-140), even value (quality 200))
* rows [9-49]
- rows to encode (odd value(Quality 0-140), even value (quality 200))
* data
- Set the datamatrix barcode data to print.

SEWOO 11 Rev. 1.113


2.19 PrintQRCode
Print the QR Code barcode.
void printQRCode(int x,int y,int model,int magfactor,char ECL,String data)
void printQRCode(int x,int y,int model,int magfactor,char ECL,String data, boolean
autoSwitches)
[Parameter]
* x, y
- Set the x, y coordination of QR Code barcode position [Dots].
* model
- 1 (original) , 2 (enhanced - recommended)
* magfactor [1-10]
- magnification factor
* ECL [H,Q,M,L]
- Error Correct Level
* data
- Set the QR Code barcode data to print.
* autoSwitches
- If set to true, 'QA,' which is Normal String & Auto, is automatically attached in front of the data.

2.20 directCommand
Send ZPL command to printer directly.
void directCommand(String command)
[Parameter]
* command
- Set the ZPL command to send.

2.21 printAndroidFont  Added in 1.085


This function is used for android embedded font printing with alignment.
void PrintAndroidFont(String textString, int widthDots, int textSize, int printY, int alignment)
void PrintAndroidFont(Typeface typeface, String textString, int widthDots, int textSize, int printY,
int alignment)
void PrintAndroidFont(Typeface typeface, Boolean isBold, String textString, int widthDots,
int textSize, int printY, int alignment)
void PrintAndroidFont(Typeface typeface, Boolean isBold, Boolean isItalic, String textString,

SEWOO 12 Rev. 1.113


int widthDots, int textSize, int printY, int alignment)
void PrintAndroidFont(Typeface typeface, Boolean isBold, Boolean isItalic, boolean isUnderline,
String textString, int widthDots, int textSize, int printY, int alignment)

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

2.22 printAndroidFont  Added in 1.085


This function is used for android embedded font printing with x, y coordination.
void PrintAndroidFont(int printX, int printY, String textString, int widthDots, int textSize)
void PrintAndroidFont(int printX, int printY, Typeface typeface, String textString, int widthDots, int
textSize)

SEWOO 13 Rev. 1.113


void PrintAndroidFont(int printX, int printY, Typeface typeface, Boolean isBold, String textString,
int widthDots, int textSize)
void PrintAndroidFont(int printX, int printY, Typeface typeface, Boolean isBold, Boolean isItalic,
String textString, int widthDots, int textSize)
void PrintAndroidFont(int printX, int printY, Typeface typeface, Boolean isBold, Boolean isItalic,
boolean isUnderline, String textString, int widthDots, int textSize)
void PrintAndroidFont(int printX, int printY, Typeface typeface, Boolean isBold, Boolean isItalic,
boolean isUnderline, String textString, int widthDots, int textSize, char rotation)

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

SEWOO 14 Rev. 1.113


2.23 downloadGraphic  Added in 1.100
This function is used for downloading the graphic.
void downloadGraphic(String filename, String imageSavedName)
void downloadGraphic(Bitmap bitmap, String imageSavedName)

[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]

2.24 printGraphic  Added in 1.100


This function is used for print the saved image with x, y coordination.
void printGraphic(String imageSavedName, int x, int y, int xMagnification, int yMagnification)

[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]

2.25 deleteGraphic  Added in 1.100


This function is used for delete the saved image.
void deleteGraphic(String imageSavedName)

[Parameter]
* imageSavedName
- Set the name of saved image in printer’s flash memory. [1 to 8 alphanumeric characters]

SEWOO 15 Rev. 1.113


2.26 getPrinterInfo  Added in 1.101
This function is used to get the printer’s information.
int getPrinterInfo(byte [] ucToPrinter, int wLength, byte [] ucFromResponse)

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

2.26 setPrinterInfo  Added in 1.101


This function is used to set the printer’s information.
void setPrinterInfo(byte [] ucToPrinter, int wLength)

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

void printPDFFile(String filename, int x, int y, int width, int compress)


void printPDFFile(File file, int x, int y, int width, int compress)
void printPDFFile(ParcelFileDescriptor fd_PDF, int x, int y, int width, int compress)

SEWOO 16 Rev. 1.113


[Parameter]
* filename
- This value is the full path of pdf file.
* file or fd_PDF
- File or ParcelFileDescriptor Object.
* x, y
- Set the start x, y coordination of print position. (Unit is dot)
* width
- Set the output size of pdf file.
* compress
- This value is a compression of data. [ 0=Raw, 1=Compress ]

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

SEWOO 17 Rev. 1.113


- add or delete space between lines(in dots)
* data
- Set the data of string to print.

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

SEWOO 18 Rev. 1.113

You might also like