public interface Printer
Modifier and Type | Method and Description |
---|---|
void |
feed(int lines)
Feed the paper by a given number of lines on the printer
|
boolean |
hasPaper()
Query the printer to find out whether there is paper in it
|
void |
print(byte[] bytes)
Send the input text to the printer to be printed.
|
void |
print(java.lang.String text)
Send the input text to the printer to be printed.
|
void |
printBarcode(java.lang.String code,
boolean withHRI,
int widthInDots,
int heightInDots) |
void |
printImage(android.graphics.Bitmap bmp,
int offsetX,
int offsetY,
int imageHeight,
int imageWidth)
Print a preset image on the printer
|
void |
setAlignment(Alignment alignment)
Set the alignment for text printed.
|
void |
setBaudRate(int baudrate)
Sets the baud rate for the printer.
|
void |
setBold(boolean enable)
Set the printer to print in bold mode, if available
|
void |
setChineseMode(boolean enable)
Set the printer to Chinese mode.
|
void |
setFontSize(int height,
int width)
Set the font size for the text following the execution of this method
|
void |
setLanguage(Language language)
Set the Language of the text to be followed on the printer.
|
void |
setPrinterPath(java.lang.String path)
Sets the device path for the printer.
|
void setBold(boolean enable)
enable
- true to enable bold mode, false to disablevoid setAlignment(Alignment alignment)
alignment
- alignment for the textAlignment
void setLanguage(Language language) throws UnsupportedPeripheralMethodException
UnsupportedPeripheralMethodException
language
- language to use. A list of available languages is defined by Language
UnsupportedPeripheralMethodException
void setChineseMode(boolean enable) throws UnsupportedPeripheralMethodException
UnsupportedPeripheralMethodException
enable
- true to set Chinese mode, false to clear itUnsupportedPeripheralMethodException
void setFontSize(int height, int width)
height
- height of the fontwidth
- width of the fontvoid print(java.lang.String text)
print(byte[])
text
- text to be printedvoid print(byte[] bytes)
print(String)
bytes
- text to be printedvoid printImage(android.graphics.Bitmap bmp, int offsetX, int offsetY, int imageHeight, int imageWidth)
bmp
- Image in bitmap formatoffsetX
- Image printing X position offsetoffsetY
- Image printing Y position offsetimageHeight
- Image Height in PixelimageWidth
- Image Width in Pixelvoid printBarcode(java.lang.String code, boolean withHRI, int widthInDots, int heightInDots)
void feed(int lines)
lines
- number of lines to feedboolean hasPaper() throws java.io.IOException
java.io.IOException
- if there is an error while communicating with the printervoid setBaudRate(int baudrate)
baudrate
- new baud rate for the printervoid setPrinterPath(java.lang.String path)
path
- Linux-style device name