public class EscCommand extends Command
Command.CHARACTER_SET, Command.ENABLE, Command.FONT, Command.FOOT, Command.HEIGHT_ZOOM, Command.HRI_POSITION, Command.JUSTIFICATION, Command.STATUS, Command.UNDERLINE_MODE, Command.WIDTH_ZOOM
Modifier and Type | Method and Description |
---|---|
boolean |
addArabicText(String text,
Command.JUSTIFICATION justification)
Insert Arabic
|
boolean |
addBarcode(String content)
Print CODABAR type barcode
|
boolean |
addCancelKanjiMode()
Setting Chinese characters is invalid
|
boolean |
addCancelUserDefinedCharacters(byte n)
Set cancel custom character
|
boolean |
addCODE128(String content)
Print CODE128 barcode
|
boolean |
addCODE39(String content)
Print UPCE type barcode
|
boolean |
addCODE93(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(String content)
Print EAN13 type barcode
|
boolean |
addEAN8(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(String content)
Print ITF type barcode
|
boolean |
addOriginRastBitImage(android.graphics.Bitmap bitmap,
int nWidth,
int nMode) |
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 |
addPrintNvBitmap(byte n,
byte mode) |
boolean |
addPrintQRCode()
Print QRCode
|
boolean |
addQueryPrinterStatus()
This method is generally 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,
int 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 |
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 |
addSelectSizeOfModuleForQRCode(byte n)
Set the QRCode unit module size
|
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 |
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(String content)
Deposit QRCode data in the printer
|
boolean |
addText(String text)
Insert text
|
boolean |
addText(String text,
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(String content)
Print UPCA type barcode
|
boolean |
addUPCE(String content)
Print UPCE type barcode
|
boolean |
addUserCommand(byte[] command)
Send printer command
|
boolean |
addUserCommand(byte[] command,
int offset,
int len,
int time) |
String |
genCode128(String content) |
String |
genCodeB(String content) |
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, isCashUseful, isConnected, openCashDrawer, setConnecter
public static EscCommand getInstance()
public boolean addHorTab()
public boolean addText(String text)
text
- Text content.public boolean addText(String text, String charsetName)
text
- Text content.charsetName
- Charset encode.public boolean addArabicText(String text, Command.JUSTIFICATION justification)
text
- Text content.justification
- Alignment.public boolean addPrintAndLineFeed()
public boolean RealtimeStatusTransmission(Command.STATUS status)
status
- Request printer status.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.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.Command.ENABLE
public boolean addTurnDoubleStrikeOnOrOff(Command.ENABLE enable)
enable
- Weighting mode.Command.ENABLE
public boolean addPrintAndFeedPaper(byte n)
n
- Paper feed length.public boolean addSelectCharacterFont(Command.FONT font)
font
- Select font.Command.FONT
public boolean addSelectInternationalCharacterSet(Command.CHARACTER_SET set)
set
- Character set number.public boolean addTurn90ClockWiseRotatin(Command.ENABLE enable)
enable
- Rotate.Command.ENABLE
public boolean addSetRelativePrintPosition(short n)
n
- Relative position to previous character.public boolean addSelectJustification(Command.JUSTIFICATION just)
just
- Alignment.Command.JUSTIFICATION
public boolean addPrintAndFeedLines(byte n)
n
- Lines count.public boolean addGeneratePlus(Command.FOOT foot, byte t1, byte t2)
foot
- Cash pin NO. .Command.FONT
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.Command.ENABLE
public boolean addSetCharacterSize(Command.WIDTH_ZOOM width, Command.HEIGHT_ZOOM height)
width
- Width magnification.Command.WIDTH_ZOOM
height
- Height magnification.Command.HEIGHT_ZOOM
public boolean addTurnReverseModeOnOrOff(Command.ENABLE enable)
enable
- Invert.Command.ENABLE
public boolean addSelectPrintingPositionForHRICharacters(Command.HRI_POSITION position)
position
- HRI position.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.Command.ENABLE
public boolean addSetFontForHRICharacter(Command.FONT font)
font
- Select character.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.DoubleHeight
- 2x height.Underline
- Set underline.Command.ENABLE
public boolean addSelectKanjiMode()
public boolean addSetKanjiUnderLine(Command.UNDERLINE_MODE underline)
underline
- Set Chinese underline or not.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.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)
public boolean addRastBitImageWithMethod(android.graphics.Bitmap bitmap, int nWidth, int nMode, int method)
bitmap
- Bitmap data.nWidth
- Bitmap width.nMode
- Print mode.method
- Bitmap processing method. ImageUtils.FLOYD_STEINBERG_DITHER
,ImageUtils.ATKINSON_DITHER
public boolean addDownloadNvBitImage(android.graphics.Bitmap[] bitmap)
bitmap
- Bitmap data.public boolean addPrintNvBitmap(byte n, byte mode)
public boolean addUPCA(String content)
content
- Barcode content.Data content range 0~9 number,content length is 11.public boolean addUPCE(String content)
content
- Barcode content.Data range 0-9,content length is 11, must start with 0.public boolean addEAN13(String content)
content
- Barcode content.Data range 0-9, length 12.public boolean addEAN8(String content)
content
- EAN8 type barcode content.Data range 0-9, length 7.public boolean addCODE39(String content)
content
- Barcode content.Data range 0-9 A-Z SP $ % + - . /public boolean addITF(String content)
content
- Barcode content.Data range 0-9 Data length Even number.public boolean addBarcode(String content)
content
- Barcode content.Data range 0-9 $ + - . / : Insert A-D before and after data.public boolean addCODE93(String content)
content
- Barcode content.Data range 0x00-0x7f.public boolean addCODE128(String content)
content
- Barcode content.Data range 0x00-0x7f.public boolean addSelectSizeOfModuleForQRCode(byte n)
n
- QRCode unit module size.public boolean addSelectErrorCorrectionLevelForQRCode(byte n)
n
- Error correction level.public boolean addStoreQRCodeData(String content)
content
- QRCode content.public boolean addPrintQRCode()
public boolean addQueryPrinterStatus()
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 IOException
buffer
- Cache area for reading data from the printer.time
- Waiting time in milliseconds (MS).IOException
- Receive data exception.