|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectcom.sap.ip.me.api.pios.connection.Connection
com.sap.ip.me.api.pios.printer.PrinterConnection
com.sap.ip.me.api.pios.printer.LinePrinter
Use this class to print text, barcodes, and images one line at a time, specifying field alignment. This printer mode is commonly used for continuous paper printers. Every field takes one line. After a field is printed the current line position is advanced. Not all printers support alignment.
Example: Center text in a line
Connector connector = Connector.getInstance();
DriverInfo[] printers = connector.listDrivers(ConnectionType.PRINTER);
PrinterParameters parameters = new PrinterParameters(printers[0]);
parameters.setPrinterMode(PrinterParameters.LINE_MODE);
LinePrinter printer = (LinePrinter)connector.open(parameters);
ScalableFont font1 = (ScalableFont) printer.getFont("Scalable");
font1.setFontSize(12);
printer.printText(font1, "Center this text", LinePrinter.ALIGN_CENTER);
printer.doPrint(1);
printer.close();
PrinterParameters,
Connection,
PrinterBarcode,
PrinterFont| Nested Class Summary |
| Nested classes inherited from class com.sap.ip.me.api.pios.printer.PrinterConnection |
PrinterConnection.Attributes |
| Field Summary | |
static int |
ALIGN_CENTER
Constant to indicate center alignment. |
static int |
ALIGN_LEFT
Constant to indicate left alignment. |
static int |
ALIGN_RIGHT
Constant to indicate right alignment. |
static int |
NO_ALIGNMENT
Constant to indicate no alignment. |
| Fields inherited from class com.sap.ip.me.api.pios.printer.PrinterConnection |
STATUS_DATA_ERROR, STATUS_FONT_NOT_AVAILABLE_ERROR, STATUS_IDLE, STATUS_INVALID_COORDINATE_ERROR, STATUS_OUT_OF_MEMORY_ERROR, STATUS_OUT_OF_PAPER, STATUS_UNKNOWN_ERROR |
| Fields inherited from class com.sap.ip.me.api.pios.connection.Connection |
attributesFileName, cfgFile, opened, parameters |
| Constructor Summary | |
protected |
LinePrinter()
Constructs a new line printer connection. |
| Method Summary | |
abstract void |
printBarcode(PrinterBarcode barcode,
byte[] data,
int alignment)
Prints a barcode at current line position. |
abstract void |
printImage(java.lang.String imageName,
int alignment)
Prints an image at current line position. |
abstract void |
printText(PrinterFont font,
java.lang.String text,
int alignment)
Prints the specified text at the current line position. |
abstract void |
setLineSpacing(float points)
Sets the space between lines. |
| Methods inherited from class com.sap.ip.me.api.pios.printer.PrinterConnection |
advance, clearError, createBarcode, createImage, deleteImage, dispose, doPrint, getFont, getFontConfigurationManager, getPrinterDPI, getPrintHeadWidth, getStatus, listFonts, loadImage, sendRawBytes |
| Methods inherited from class com.sap.ip.me.api.pios.connection.Connection |
close, getParameters, isOpen, open |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final int NO_ALIGNMENT
public static final int ALIGN_LEFT
public static final int ALIGN_CENTER
public static final int ALIGN_RIGHT
| Constructor Detail |
protected LinePrinter()
throws PIOSException
PIOSException - thrown if an error is detected while creating/
opening the printer connection.| Method Detail |
public abstract void setLineSpacing(float points)
throws UnsupportedException,
PrinterException
points - the height of the space between lines
UnsupportedException - thrown if command not supported by the printer
PrinterException - thrown when invalid parameter value are used
public abstract void printText(PrinterFont font,
java.lang.String text,
int alignment)
throws UnsupportedException,
PrinterException
font - the text fonttext - the text to printalignment - the text alignment
UnsupportedException - thrown if alignment is not supported by the printer
PrinterException - thrown if an error occurs while printing the text
public abstract void printBarcode(PrinterBarcode barcode,
byte[] data,
int alignment)
throws UnsupportedException,
PrinterException
barcode - the PrinterBarcode object that include information of symbology and printing optionsdata - the data to be encoded in barcodealignment - the barcode alignment
UnsupportedException - thrown if alignment is not supported by the printer
PrinterException - thrown if an error occurs while printing the barcodecom.sap.ip.me.api.pios.symbology
public abstract void printImage(java.lang.String imageName,
int alignment)
throws UnsupportedException,
PrinterException
imageName - the image namealignment - the image alignment
UnsupportedException - thrown if alignment is not supported by the printer
PrinterException - thrown if an error occurs while printing the image
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||