public class ESCPOSPrinter
extends java.lang.Object
Constructor and Description |
---|
ESCPOSPrinter() |
Modifier and Type | Method and Description |
---|---|
int |
clearOutput()
This method is used to clear all buffered output data by tranzactionPrint method and pageModePrint method.
|
int |
clearPrintArea()
This method is used to clear the area defined by the PageModePrintArea property.
|
int |
connect(int connectType,
java.lang.String addr)
This method is used to connect the printer.
|
int |
connect(int connectType,
java.lang.String addr,
int port)
This method is used to connect the printer.
|
int |
connect(int connectType,
java.lang.String addr,
int port,
int timeout)
This method is used to connect the printer.
|
int |
connect(int connectType,
UsbDevice device)
This method is used to connect the printer.
|
int |
cutPaper(int percentage)
This method is used to cut the paper.
|
int |
disconnect()
This method is used to disconnect the printer connection.
|
int |
getMapMode()
This property holds the mapping mode of the printer.
Returns the mapping mode that is set as the return value. |
java.lang.String |
getPageModeArea()
This property holds the page area.
Returns the page area as the return value. |
int |
getPageModeHorizontalPosition()
This property holds the horizontal start position offset within the Page Mode print area.
Returns the horizontal position of Page Mode print area that is set as the return value. |
java.lang.String |
getPageModePrintArea()
This property holds the print area of Page Mode.
Returns the Page Mode print area that is set as the return value. |
int |
getPageModePrintDirection()
This property holds the print direction of the Page Mode print area.
Returns the print direction of Page Mode print area that is set as the return value. |
int |
getPageModeVerticalPosition()
This property holds the vertical start position offset within the Page Mode print area.
Returns the vertical position of Page Mode print area that is set as the return value. |
int |
getRecLineSpacing()
This property holds the spacing of each single-high print line, including both the printed line height plus the whitespace between each pair of lines.
Returns the spacing of each single-high print line that is set as the return value. |
int |
getVersionCode()
This method is used to get a numerical value for the version number of this library.
|
java.lang.String |
getVersionName()
This method is used to get a string for the version number of this library.
|
int |
markFeed(int type)
This method is used to utilize label paper and black mark paper.
|
int |
openDrawer(int drawer,
int pulseLen)
This method is used to open the cash drawer is connected to the printer.
|
int |
pageModePrint(int control)
This method is used to start or end a Page Mode.
|
int |
printBarCode(java.lang.String data,
int symbology,
int height,
int width,
int alignment,
int textPosition)
This method is used to print one-dimensional barcode.
|
int |
printBitmap(Bitmap bitmap,
int alignment)
This method is used to print bitmap which specifies file name or bitmap and width and alignment.
|
int |
printBitmap(Bitmap bitmap,
int width,
int alignment)
This method is used to print bitmap which specifies file name or bitmap and width and alignment.
|
int |
printBitmap(Bitmap bitmap,
int width,
int alignment,
int mode)
This method is used to print bitmap which specifies file name or bitmap and width and alignment.
|
int |
printBitmap(java.lang.String fileName,
int alignment)
This method is used to print bitmap which specifies file name or bitmap and width and alignment.
|
int |
printBitmap(java.lang.String fileName,
int width,
int alignment)
This method is used to print bitmap which specifies file name or bitmap and width and alignment.
|
int |
printBitmap(java.lang.String fileName,
int width,
int alignment,
int mode)
This method is used to print bitmap which specifies file name or bitmap and width and alignment.
|
int |
printData(byte[] data)
This method is used to send data bytes to the printer directly.
|
int |
printerCheck()
This method is used to send the command to get the status of the printer.
|
int |
printGS1DataBarStacked(java.lang.String data,
int symbology,
int moduleSize,
int maxWidth,
int alignment)
This method is used to print 2-dimensional GS1 DataBar barcode.
|
int |
printNormal(java.lang.String data)
This method is used to print using the escape sequences that are defined in the OPOS.
|
int |
printNVBitmap(int nvImageNumber)
This method is used to print bitmap image (Logo) that is stored in the flash memory of the printer.
|
int |
printPaddingText(java.lang.String data,
int attribute,
int textSize,
int length,
int side)
This method is used to print text with space padding which specifies attribute and size and length of the single-byte character equivalent and side where space is added.
|
int |
printPDF417(java.lang.String data,
int digits,
int steps,
int moduleWidth,
int stepHeight,
int ECLevel,
int alignment)
This method is used to print PDF-417 barcode.
|
int |
printQRCode(java.lang.String data,
int moduleSize,
int ECLevel,
int alignment)
This method is used to print QRCode barcode.
|
int |
printText(java.lang.String data,
int alignment,
int attribute,
int textSize)
This method is used to print text which specifies alignment and attribute and size.
|
int |
printTextLocalFont(java.lang.String data,
int alignment,
Typeface fontType,
int point,
int style,
int hRatio,
int vRatio)
This method is used to print text by using a font installed in the computer, which specifies alignment, font, size, style, and ratio.
|
int |
rotatePrint(int rotation)
This method is used to start or end a rotation print mode.
|
CitizenPrinterInfo[] |
searchCitizenPrinter(int ifType,
int searchTime,
int[] status)
This method is used to search the printer and get the list of printer information.
|
java.lang.String[] |
searchESCPOSPrinter(int ifType,
int searchTime,
int[] status)
This method is used to search the printer and get the list of addresses.
|
int |
setContext(Context context)
This method is used to the USB connection and the search printer.
|
int |
setEncoding(java.lang.String charset)
This method is used to set the encoding of the send data to the printer.
|
void |
setLog(int mode,
java.lang.String path,
int maxSize)
Sets the logging function.
|
int |
setMapMode(int mode)
This property holds the mapping mode of the printer.
Please specify the property value that you want to set in the parameter. |
int |
setNVBitmap(int number,
java.lang.String fileName,
int width)
This method is used to store bitmap which specifies number, file name, width as parameters.
|
int |
setNVBitmap(int number,
java.lang.String fileName,
int width,
int mode)
This method is used to store bitmap which specifies number, file name, width, mode as parameters.
|
int |
setPageModeHorizontalPosition(int position)
This property holds the horizontal start position offset within the Page Mode print area.
Please specify the property value that you want to set in the parameter. |
int |
setPageModePrintArea(java.lang.String area)
This property holds the print area of Page Mode.
Please specify the property value that you want to set in the parameter. |
int |
setPageModePrintDirection(int direction)
This property holds the print direction of the Page Mode print area.
Please specify the property value that you want to set in the parameter. |
int |
setPageModeVerticalPosition(int position)
This property holds the vertical start position offset within the Page Mode print area.
Please specify the property value that you want to set in the parameter. |
int |
setRecLineSpacing(int space)
This property holds the spacing of each single-high print line, including both the printed line height plus the whitespace between each pair of lines.
Please specify the property value that you want to set in the parameter. |
int |
status()
This method is used to get the status of the printer obtained by the printerCheck method.
|
int |
status(int mask)
This method is used to get the status of the printer obtained by the printerCheck method.
|
int |
transactionPrint(int control)
This method is used to start or end a transaction mode.
|
int |
unitFeed(int lfCount)
This method is used to feed the paper in dot units.
|
int |
watermarkPrint(int start,
int nvImageNumber,
int pass,
int feed,
int repeat)
This method is used to print watermark.
|
public int clearOutput()
public int clearPrintArea()
public int connect(int connectType, java.lang.String addr)
connectType
- : Connect typeaddr
- : IP address to connect or Bluetooth device address or Bluetooth device namepublic int connect(int connectType, java.lang.String addr, int port)
connectType
- : Connect typeaddr
- : IP address to connect or Bluetooth device address or Bluetooth device nameport
- : Connection port numbercpublic int connect(int connectType, java.lang.String addr, int port, int timeout)
connectType
- : Connect typeaddr
- :IP address to connect or Bluetooth device address or Bluetooth device nameport
- : Connection port numbertimeout
- : Timeout (msec)public int connect(int connectType, UsbDevice device)
connectType
- : Connect typedevice
- : UsbDevice class (android.hardware.usb.UsbDevice)public int cutPaper(int percentage)
percentage
- : Cut typepublic int disconnect()
public int getMapMode()
public java.lang.String getPageModeArea()
public int getPageModeHorizontalPosition()
public java.lang.String getPageModePrintArea()
public int getPageModePrintDirection()
public int getPageModeVerticalPosition()
public int getRecLineSpacing()
public int getVersionCode()
public java.lang.String getVersionName()
public int markFeed(int type)
type
- : Handling type of label paper or black mark paperpublic int openDrawer(int drawer, int pulseLen)
drawer
- : Cash drawer numberpulseLen
- : Signal lengthpublic int pageModePrint(int control)
control
- : Page Mode controlpublic int printBarCode(java.lang.String data, int symbology, int height, int width, int alignment, int textPosition)
data
- : Barcode datasymbology
- : Barcode symbol typeheight
- : Barcode heightwidth
- : Barcode horizontal size (magnification)alignment
- : Barcode alignmenttextPosition
- : HRI characters positionpublic int printBitmap(Bitmap bitmap, int alignment)
bitmap
- : Bitmap type dataalignment
- : Bitmap alignmentpublic int printBitmap(Bitmap bitmap, int width, int alignment)
bitmap
- : Bitmap type datawidth
- : Bitmap widthalignment
- : Bitmap alignmentpublic int printBitmap(Bitmap bitmap, int width, int alignment, int mode)
bitmap
- : Bitmap type datawidth
- : Bitmap widthalignment
- : Bitmap alignmentmode
- : Bitmap modepublic int printBitmap(java.lang.String fileName, int alignment)
fileName
- : Bitmap file namealignment
- : Bitmap alignmentpublic int printBitmap(java.lang.String fileName, int width, int alignment)
fileName
- : Bitmap file namewidth
- : Bitmap widthalignment
- : Bitmap alignmentpublic int printBitmap(java.lang.String fileName, int width, int alignment, int mode)
fileName
- : Bitmap file namewidth
- : Bitmap widthalignment
- : Bitmap alignmentmode
- : Bitmap modepublic int printData(byte[] data)
data
- : Send datapublic int printerCheck()
public int printGS1DataBarStacked(java.lang.String data, int symbology, int moduleSize, int maxWidth, int alignment)
data
- : Barcode datasymbology
- : Barcode symbol typemoduleSize
- : Module widthmaxWidth
- : Max widthalignment
- : Barcode alignmentpublic int printNormal(java.lang.String data)
data
- : Print data (Support OPOS escape sequence)public int printNVBitmap(int nvImageNumber)
nvImageNumber
- : Bitmap image number that is stored in the flash memory of the printerpublic int printPaddingText(java.lang.String data, int attribute, int textSize, int length, int side)
data
- : Text dataattribute
- : Text attributetextSize
- : Text sizelength
- : Print lengthside
- : Space add sidepublic int printPDF417(java.lang.String data, int digits, int steps, int moduleWidth, int stepHeight, int ECLevel, int alignment)
data
- : Barcode datadigits
- : Digits numbersteps
- : Steps numbermoduleWidth
- : Module widthstepHeight
- : Height of stepECLevel
- : Error correction levelalignment
- : Barcode alignmentpublic int printQRCode(java.lang.String data, int moduleSize, int ECLevel, int alignment)
data
- : Barcode datamoduleSize
- : Module widthECLevel
- : Error correction levelalignment
- : Barcode alignmentpublic int printText(java.lang.String data, int alignment, int attribute, int textSize)
data
- : Text dataalignment
- : Text alignmentattribute
- : Text attributetextSize
- : Text sizepublic int printTextLocalFont(java.lang.String data, int alignment, Typeface fontType, int point, int style, int hRatio, int vRatio)
data
- : Text dataalignment
- : Text alignmentfontType
- : Font typepoint
- : Font sizestyle
- : Font stylehRatio
- : Horizontal enlargement ratiovRatio
- : Vertical enlargement ratiopublic int rotatePrint(int rotation)
rotation
- : Direction of rotationpublic CitizenPrinterInfo[] searchCitizenPrinter(int ifType, int searchTime, int[] status)
ifType
- : Connect typesearchTime
- : Search timestatus
- : Error codepublic java.lang.String[] searchESCPOSPrinter(int ifType, int searchTime, int[] status)
ifType
- : Connect typesearchTime
- : Search timestatus
- : Error codepublic int setContext(Context context)
context
- : Context (android.content.Context)public int setEncoding(java.lang.String charset)
charset
- : Charcter set namepublic void setLog(int mode, java.lang.String path, int maxSize)
mode
- : Logging modepath
- : File path to storemaxSize
- : Maximum Log Sizepublic int setMapMode(int mode)
mode
- : Map modepublic int setNVBitmap(int number, java.lang.String fileName, int width)
number
- : Number of bitmap to store in the flash memory of the printerfileName
- : Bitmap file namewidth
- : Bitmap widthpublic int setNVBitmap(int number, java.lang.String fileName, int width, int mode)
number
- : Number of bitmap to store in the flash memory of the printerfileName
- : Bitmap file namewidth
- : Bitmap widthmode
- : Bitmap modepublic int setPageModeHorizontalPosition(int position)
position
- : mode horizontal positionpublic int setPageModePrintArea(java.lang.String area)
area
- : page mode print areapublic int setPageModePrintDirection(int direction)
direction
- : page mode print directionpublic int setPageModeVerticalPosition(int position)
position
- : page mode vertical positionpublic int setRecLineSpacing(int space)
space
- : rec line spacepublic int status()
public int status(int mask)
mask
- : Status typepublic int transactionPrint(int control)
control
- : Transaction controlpublic int unitFeed(int lfCount)
lfCount
- : Number of paper feedpublic int watermarkPrint(int start, int nvImageNumber, int pass, int feed, int repeat)
start
- : The start / Stop of the watermark printnvImageNumber
- : The NV image number that is stored in the flash memory of the printerpass
- : The first start position (vertical direction) of the watermarkfeed
- : The blank length each waternarkrepeat
- : The print number of times of the watermark