public class EscCommand extends Command
Command.CHARACTER_SET, Command.ENABLE, Command.FONT, Command.FOOT, Command.HEIGHT_ZOOM, Command.HRI_POSITION, Command.ImageAlgorithm, Command.JUSTIFICATION, Command.STATUS, Command.UNDERLINE_MODE, Command.WIDTH_ZOOM
mConnecter, mContext
Modifier and Type | Method and Description |
---|---|
boolean |
addArabicText(java.lang.String text,
Command.JUSTIFICATION justification)
Insert Arabic.
|
boolean |
addBarcode(java.lang.String content)
Print CODABAR type barcode.
|
boolean |
addBlackMark(boolean isOpenBlackMark)
Set black mark mode.
|
boolean |
addBlackMarkCutterPosition(int vertical)
Set the black mark paper cutting position.
|
boolean |
addBlackMarkPagerLength(int length)
Set black mark length.
|
boolean |
addBlackMarkStartPrintPosition(int vertical)
Set the black mark starting printing position.
|
boolean |
addBlackMarkWidth(int width)
Set black mark width.
|
boolean |
addCancelKanjiMode()
Setting Chinese characters is invalid.
|
boolean |
addCancelPrintData()
Cancel printing data in page mode.
|
boolean |
addCancelUserDefinedCharacters(byte n)
Set cancel custom character.
|
boolean |
addCODE128(java.lang.String content)
Print CODE128 barcode.
|
boolean |
addCODE39(java.lang.String content)
Print Code39 type barcode.
|
boolean |
addCODE93(java.lang.String content)
Print CODE93 barcode.
|
boolean |
addCutAndFeedPaper(byte length)
Set the paper feed after cutting.
|
boolean |
addCutPaper()
Cut paper.
|
boolean |
addDownloadNvBitImage(android.graphics.Bitmap[] bitmap)
Download NV bitmap.
|
boolean |
addEAN13(java.lang.String content)
Print EAN13 type barcode.
|
boolean |
addEAN8(java.lang.String content)
Print EAN8 type barcode.
|
boolean |
addGeneratePlus(Command.FOOT foot,
byte t1,
byte t2)
Open cash.
|
boolean |
addGeneratePluseAtRealtime(Command.FOOT foot,
byte t)
Open the cash.
|
boolean |
addHorTab()
Insert horizontal tab.
|
boolean |
addInitializePrinter()
Printer initialization.
|
boolean |
addITF(java.lang.String content)
Print ITF type barcode.
|
boolean |
addOriginRastBitImage(android.graphics.Bitmap bitmap,
int nWidth,
int nMode)
Print raster bitmap.
|
boolean |
addPageModeVerticalAbsolutePosition(int position)
Set vertical absolute position in page mode.
|
boolean |
addPageModeVerticalRelativePosition(int position)
Set vertical relative position in page mode.
|
boolean |
addPdf417Content(java.lang.String content)
Set PDF417 print content
|
boolean |
addPdf417ErrorCorrectionLevel(int level)
Set the PDF417 error correction level
|
boolean |
addPdf417ModuleWidth(int width)
Set PDF417 module width
|
boolean |
addPdf417Options(int options)
Set PDF417 options
|
boolean |
addPdf417PositionCount(int length)
Set PDF417 position count (level length)
|
boolean |
addPdf417SymbolLevelHeight(int level)
Set the PDF417 symbol level height
|
boolean |
addPrint()
Print in page mode.
|
boolean |
addPrintAndFeedLines(byte n)
Print and feed multiple lines.
|
boolean |
addPrintAndFeedPaper(byte n)
Set the paper distance after printing.
|
boolean |
addPrintAndLineFeed()
Paper feed line.
|
boolean |
addPrintAndSwitchStandardMode()
Print in page mode and return to standard mode.
|
boolean |
addPrintNvBitmap(byte n,
byte mode)
Print NV bitmap.
|
boolean |
addPrintPdf417()
Print PDF417
|
boolean |
addPrintQRCode()
Print QRCode.
|
boolean |
addQueryPrinterStatus()
This method is usually added at the end of an order.
|
boolean |
addRastBitImage(android.graphics.Bitmap bitmap,
int nWidth,
int nMode)
Print raster bitmap.
|
boolean |
addRastBitImageWithMethod(android.graphics.Bitmap bitmap,
int nWidth,
int nMode,
Command.ImageAlgorithm method)
Printing raster bitmaps You need to choose a printing algorithm that can be accessed via ImageUtils.
|
boolean |
addSelectCharacterFont(Command.FONT font)
Set character type.
|
boolean |
addSelectCodePage(byte page)
Set code page.
|
boolean |
addSelectDefualtLineSpacing()
Set as default row spacing.
|
boolean |
addSelectErrorCorrectionLevelForQRCode(byte n)
Set QRCode error correction level.
|
boolean |
addSelectInternationalCharacterSet(Command.CHARACTER_SET set)
Set international character set.
|
boolean |
addSelectJustification(Command.JUSTIFICATION just)
Set alignment.
|
boolean |
addSelectKanjiMode()
Set Chinese character valid.
|
boolean |
addSelectOrCancelUserDefineCharacter(Command.ENABLE enable)
Set whether to cancel custom characters.
|
boolean |
addSelectPageMode()
Select page mode.
|
boolean |
addSelectPrintingPositionForHRICharacters(Command.HRI_POSITION position)
Set barcode recognizable characters HRI.
|
boolean |
addSelectPrintModes(Command.FONT font,
Command.ENABLE emphasized,
Command.ENABLE doubleheight,
Command.ENABLE doublewidth,
Command.ENABLE underline)
Set print mode.
|
boolean |
addSelectPrintOrientation(int n)
Select print area direction in page mode.
|
boolean |
addSelectSizeOfModuleForQRCode(byte n)
Set the QRCode unit module size.
|
boolean |
addSelectStandardMode()
Select standard mode.
|
boolean |
addSetAbsolutePrintPosition(short n)
Set absolute print position.
|
boolean |
addSetAutoSatusBack(Command.ENABLE enable)
Set whether the printer returns to the status automatically.
|
boolean |
addSetBarcodeHeight(byte height)
Set barcode height.
|
boolean |
addSetBarcodeWidth(byte width)
Set barcode unit width.
|
boolean |
addSetCharacterSize(Command.WIDTH_ZOOM width,
Command.HEIGHT_ZOOM height)
Set character magnification.
|
boolean |
addSetFontForHRICharacter(Command.FONT font)
Set barcode character type.
|
boolean |
addSetHorAndVerMotionUnits(byte x,
byte y)
Set horizontal and vertical unit distance.
|
boolean |
addSetKanjiFontMode(Command.ENABLE DoubleWidth,
Command.ENABLE DoubleHeight,
Command.ENABLE Underline)
Set Chinese font.
|
boolean |
addSetKanjiLefttandRightSpace(byte left,
byte right)
Set the left and right spacing of Chinese characters.
|
boolean |
addSetKanjiUnderLine(Command.UNDERLINE_MODE underline)
Set Chinese underline.
|
boolean |
addSetLeftMargin(short n)
Set printing left spacing.
|
boolean |
addSetLineSpacing(byte n)
Set row spacing.
|
boolean |
addSetPrintArea(int x,
int y,
int width,
int height)
Set printing area in page mode.
|
boolean |
addSetPrintingAreaWidth(short width)
Set print width.
|
boolean |
addSetQuadrupleModeForKanji(Command.ENABLE enable)
Set the Chinese character double width and height.
|
boolean |
addSetRelativePrintPosition(short n)
Set relative printing position.
|
boolean |
addSetRightSideCharacterSpacing(byte n)
Set character right spacing.
|
boolean |
addSound(byte n,
byte t)
Buzzer.
|
boolean |
addStoreQRCodeData(java.lang.String content)
Deposit QRCode data in the printer.
|
boolean |
addText(int printWidth,
java.lang.String text,
int fontSize,
boolean bold,
boolean underline)
Print Text.
|
boolean |
addText(java.lang.String text)
Insert text.
|
boolean |
addText(java.lang.String text,
java.lang.String charsetName)
Insert text.
|
boolean |
addTurn90ClockWiseRotatin(Command.ENABLE enable)
Set whether the character rotates 90°.
|
boolean |
addTurnDoubleStrikeOnOrOff(Command.ENABLE enable)
Set weighting mode.
|
boolean |
addTurnEmphasizedModeOnOrOff(Command.ENABLE enabel)
Set bold mode.
|
boolean |
addTurnReverseModeOnOrOff(Command.ENABLE enable)
Set invert mode.
|
boolean |
addTurnUnderlineModeOnOrOff(Command.UNDERLINE_MODE underline)
Set underline.
|
boolean |
addTurnUpsideDownModeOnOrOff(Command.ENABLE enable)
Set upside down mode.
|
boolean |
addUPCA(java.lang.String content)
Print UPCA type barcode.
|
boolean |
addUPCE(java.lang.String content)
Print UPCE type barcode.
|
boolean |
addUserCommand(byte[] command)
Send printer command.
|
boolean |
addUserCommand(byte[] command,
int offset,
int len,
int time)
Send printer command.
|
java.lang.String |
genCode128(java.lang.String content) |
java.lang.String |
genCodeB(java.lang.String content)
Code128 Character set B.
|
java.lang.String |
genCodeC(java.lang.String content)
Code128 Character set C.
|
static EscCommand |
getInstance() |
int |
read(byte[] buffer,
int time)
Receive data.
|
boolean |
RealtimeStatusTransmission(Command.STATUS status)
Printer real time status request.
|
close, connect, connect, getConnecter, isConnected, openCashDrawer, setConnecter
public static EscCommand getInstance()
public boolean addHorTab()
public boolean addText(java.lang.String text)
text
- Text content.public boolean addText(java.lang.String text, java.lang.String charsetName)
text
- Text content.charsetName
- Charset encode.public boolean addText(int printWidth, java.lang.String text, int fontSize, boolean bold, boolean underline)
printWidth
- Print width.text
- Print content.fontSize
- Text size.bold
- Text bold.True is bold,false is normal.underline
- Text underline.True is add underline,else is normal.public boolean addArabicText(java.lang.String text, Command.JUSTIFICATION justification)
text
- Text content.public boolean addPrintAndLineFeed()
public boolean RealtimeStatusTransmission(Command.STATUS status)
status
- Request printer status.See Command.STATUS
public boolean addGeneratePluseAtRealtime(Command.FOOT foot, byte t)
foot
- Cash pin NO.Command.FOOT
t
- Cash pulse time(tx100ms).public boolean addSound(byte n, byte t)
n
- Number of beeps.t
- The number of beeps per time, in milliseconds(tx50).public boolean addSetRightSideCharacterSpacing(byte n)
n
- Spacing value.public boolean addSelectPrintModes(Command.FONT font, Command.ENABLE emphasized, Command.ENABLE doubleheight, Command.ENABLE doublewidth, Command.ENABLE underline)
font
- Select print font.Command.FONT
emphasized
- Set bold.doubleheight
- 2x height.doublewidth
- 2x width.underline
- Set underline.public boolean addSetAbsolutePrintPosition(short n)
n
- Distance from starting printing position.public boolean addSelectOrCancelUserDefineCharacter(Command.ENABLE enable)
enable
- Custom characters is cancel.public boolean addTurnUnderlineModeOnOrOff(Command.UNDERLINE_MODE underline)
underline
- Underline type.See Command.UNDERLINE_MODE
public boolean addSelectDefualtLineSpacing()
public boolean addSetLineSpacing(byte n)
n
- Row spacing height, including text.public boolean addCancelUserDefinedCharacters(byte n)
n
- Custom character number.public boolean addInitializePrinter()
public boolean addTurnEmphasizedModeOnOrOff(Command.ENABLE enabel)
enabel
- Turn bold on or off.See Command.ENABLE
public boolean addTurnDoubleStrikeOnOrOff(Command.ENABLE enable)
enable
- Weighting mode.See Command.ENABLE
public boolean addPrintAndFeedPaper(byte n)
n
- Paper feed length.public boolean addSelectCharacterFont(Command.FONT font)
font
- FONTA or FONTB.See Command.FONT
public boolean addSelectInternationalCharacterSet(Command.CHARACTER_SET set)
set
- Character set number.public boolean addTurn90ClockWiseRotatin(Command.ENABLE enable)
enable
- Rotate.See Command.ENABLE
public boolean addSetRelativePrintPosition(short n)
n
- Relative position to previous character.public boolean addSelectJustification(Command.JUSTIFICATION just)
just
- Alignment.See Command.JUSTIFICATION
public boolean addPrintAndFeedLines(byte n)
n
- Lines count.public boolean addGeneratePlus(Command.FOOT foot, byte t1, byte t2)
foot
- Cash pin NO.See Command.FOOT
t1
- High level time.t2
- Low level time.public boolean addSelectCodePage(byte page)
page
- Code page number.public boolean addTurnUpsideDownModeOnOrOff(Command.ENABLE enable)
enable
- Upside down.See Command.ENABLE
public boolean addSetCharacterSize(Command.WIDTH_ZOOM width, Command.HEIGHT_ZOOM height)
width
- Width magnification.See Command.WIDTH_ZOOM
height
- Height magnification.See Command.HEIGHT_ZOOM
public boolean addTurnReverseModeOnOrOff(Command.ENABLE enable)
enable
- Invert.See Command.ENABLE
public boolean addSelectPrintingPositionForHRICharacters(Command.HRI_POSITION position)
position
- HRI position.See Command.HRI_POSITION
public boolean addSetLeftMargin(short n)
n
- Left spacing.public boolean addSetHorAndVerMotionUnits(byte x, byte y)
x
- Horizontal unit distance.y
- Vertical unit distance.public boolean addCutAndFeedPaper(byte length)
length
- Feed length.public boolean addCutPaper()
public boolean addSetPrintingAreaWidth(short width)
width
- Print width.public boolean addSetAutoSatusBack(Command.ENABLE enable)
enable
- Start auto return printer status.See Command.ENABLE
public boolean addSetFontForHRICharacter(Command.FONT font)
font
- Select character.See Command.FONT
public boolean addSetBarcodeHeight(byte height)
height
- Barcode height.public boolean addSetBarcodeWidth(byte width)
width
- Barcode unit width.public boolean addSetKanjiFontMode(Command.ENABLE DoubleWidth, Command.ENABLE DoubleHeight, Command.ENABLE Underline)
DoubleWidth
- 2x width.See Command.ENABLE
DoubleHeight
- 2x height.See Command.ENABLE
Underline
- Set underline.See Command.ENABLE
public boolean addSelectKanjiMode()
public boolean addSetKanjiUnderLine(Command.UNDERLINE_MODE underline)
underline
- Set Chinese underline or not.See Command.UNDERLINE_MODE
public boolean addCancelKanjiMode()
public boolean addSetKanjiLefttandRightSpace(byte left, byte right)
left
- Left spacing.right
- Right spacing.public boolean addSetQuadrupleModeForKanji(Command.ENABLE enable)
enable
- Whether to open the double width double.See Command.ENABLE
public boolean addRastBitImage(android.graphics.Bitmap bitmap, int nWidth, int nMode)
bitmap
- Bitmap data.nWidth
- Bitmap width.nMode
- Raster bitmap mode.public boolean addOriginRastBitImage(android.graphics.Bitmap bitmap, int nWidth, int nMode)
bitmap
- Bitmap data.nWidth
- Bitmap width.nMode
- Raster bitmap mode.public boolean addRastBitImageWithMethod(android.graphics.Bitmap bitmap, int nWidth, int nMode, Command.ImageAlgorithm method)
bitmap
- Bitmap data.nWidth
- Bitmap width.nMode
- Print mode.method
- Bitmap processing method.See Command.ImageAlgorithm
public boolean addDownloadNvBitImage(android.graphics.Bitmap[] bitmap)
bitmap
- Bitmap data.public boolean addPrintNvBitmap(byte n, byte mode)
n
- NV logo index.mode
- Print nv logo mode.public boolean addUPCA(java.lang.String content)
content
- Barcode content.Data content range 0~9 number,content length is 11.public boolean addUPCE(java.lang.String content)
content
- Barcode content.Data range 0-9,content length is 11, must start with 0.public boolean addEAN13(java.lang.String content)
content
- Barcode content.Data range 0-9, length 12.public boolean addEAN8(java.lang.String content)
content
- EAN8 type barcode content.Data range 0-9, length 7.public boolean addCODE39(java.lang.String content)
content
- Barcode content.Data range 0-9 A-Z SP $ % + - . /public boolean addITF(java.lang.String content)
content
- Barcode content.Data range 0-9 Data length Even number.public boolean addBarcode(java.lang.String content)
content
- Barcode content.Data range 0-9 $ + - . / : Insert A-D before and after data.public boolean addCODE93(java.lang.String content)
content
- Barcode content.Data range 0x00-0x7f.public boolean addCODE128(java.lang.String content)
content
- Barcode content.Data range 0x00-0x7f.public java.lang.String genCodeC(java.lang.String content)
content
- Barcode content.Data range 0x00-0x7f.public java.lang.String genCodeB(java.lang.String content)
content
- Barcode content.public java.lang.String genCode128(java.lang.String content)
public boolean addSelectSizeOfModuleForQRCode(byte n)
n
- QRCode unit module size.public boolean addSelectErrorCorrectionLevelForQRCode(byte n)
n
- Error correction level.public boolean addStoreQRCodeData(java.lang.String content)
content
- QRCode content.public boolean addPrintQRCode()
public boolean addQueryPrinterStatus()
read(byte[], int)
method. Can be used to achieve continuous printing function.public boolean addBlackMark(boolean isOpenBlackMark)
isOpenBlackMark
- true Turn on black mark,false turn off black mark.public boolean addBlackMarkPagerLength(int length)
length
- Black mark pager length.public boolean addBlackMarkWidth(int width)
width
- Black mark width.public boolean addBlackMarkStartPrintPosition(int vertical)
vertical
- Vertical distance from black mark. Unit: mm.public boolean addBlackMarkCutterPosition(int vertical)
vertical
- The vertical distance between the paper cutting position and the black mark. Unit: mm.public boolean addPageModeVerticalAbsolutePosition(int position)
position
- Vertical position.public boolean addPageModeVerticalRelativePosition(int position)
position
- Vertical position.public boolean addSelectPageMode()
public boolean addSelectStandardMode()
public boolean addSelectPrintOrientation(int n)
n
- Specify the direction and starting position of the printing area.
0 ≤ n ≤ 3 or 48 ≤ n ≤ 51
n=0 printing direction from left to right;
n=1 Printing direction from bottom to top;
n=2 Printing direction from right to left;
n=3 Printing direction from top to bottom;public boolean addSetPrintArea(int x, int y, int width, int height)
x
- Lateral starting position.y
- Longitudinal starting position.width
- Print area width.height
- Print area height.public boolean addPrintAndSwitchStandardMode()
public boolean addCancelPrintData()
public boolean addPrint()
public boolean addPdf417PositionCount(int length)
public boolean addPdf417ModuleWidth(int width)
public boolean addPdf417SymbolLevelHeight(int level)
public boolean addPdf417ErrorCorrectionLevel(int level)
level
- error correction level.Level range 48~56
level=48 Error correction level 0;
level=49 Error correction level 1;
level=50 Error correction level 2;
level=51 Error correction level 3;
level=52 Error correction level 4;
level=53 Error correction level 5;
level=54 Error correction level 6;
level=55 Error correction level 7;
level=56 Error correction level 8;public boolean addPdf417Options(int options)
options
- PDF417 options.options=0 Selects the standard PDF417 options,options=1 Selects the simple PDF417 options.public boolean addPdf417Content(java.lang.String content)
content
- PDF417 contentpublic boolean addPrintPdf417()
public boolean addUserCommand(byte[] command)
command
- Printer command.public boolean addUserCommand(byte[] command, int offset, int len, int time)
command
- Printer command.offset
- The start offset in the data.len
- The number of bytes to write.time
- Timeout, in milliseconds (ms).public int read(byte[] buffer, int time) throws java.io.IOException
buffer
- Cache area for reading data from the printer.time
- Waiting time in milliseconds (MS).java.io.IOException
- Receive data exception.