|
|||||||||||
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.GraphicPrinter
A graphic printer refers to a printer that supports X, Y coordinates to locate text, barcodes, images, or graphics to be printed. The coordinates are specified in points (1/72th of an inch). Fields may also be rotated, if the printer supports rotation.
Example: Draw text rotated 90 degrees
Connector connector = Connector.getInstance();
DriverInfo[] printers = connector.listDrivers(ConnectionType.PRINTER);
PrinterParameters parameters = new PrinterParameters(printers[0]);
parameters.setPrinterMode(PrinterParameters.GRAPHIC_MODE);
GraphicPrinter printer = (GraphicPrinter)connector.open(parameters);
ScalableFont font1 = (ScalableFont) printer.getFont("Scalable");
font1.setFontSize(12);
printer.drawText(font1, 100, 100, "I like rotation",
GraphicPrinter.ROTATE_90_DEGREES);
printer.doPrint(1);
printer.close();
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 |
NO_ROTATION
Constant to indicate no rotation. |
static int |
ROTATE_180_DEGREES
Constant to indicate a rotation of 180 degrees. |
static int |
ROTATE_270_DEGREES
Constant to indicate a rotation of 270 degrees. |
static int |
ROTATE_90_DEGREES
Constant to indicate a rotation of 90 degrees. |
Fields inherited from class com.sap.ip.me.api.pios.printer.PrinterConnection |
STATUS_BUSY, 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 |
GraphicPrinter()
Constructs a new graphic printer connection. |
Method Summary | |
abstract void |
drawBarcode(PrinterBarcode barcode,
float x,
float y,
byte[] data,
int rotate)
Draws a barcode at the specified coordinates. |
abstract void |
drawImage(java.lang.String name,
float x,
float y,
int rotate)
Draws an image at the specified coordinates. |
abstract void |
drawLine(float x0,
float y0,
float x1,
float y1,
float thickness)
Draws a line using the specified coordinates. |
abstract void |
drawRectangle(float x,
float y,
float width,
float height,
float thickness)
Draws a rectangle using the specified point coordinate for the left most top corner of the rectangle and the width and height. |
abstract void |
drawText(PrinterFont font,
float x,
float y,
java.lang.String text,
int rotate)
Draws a text field using the particular font at the specified coordinates. |
abstract void |
drawTransientImage(java.awt.Image img,
float x,
float y,
int rotate)
Draws a transient image at the specified coordinates. |
abstract Metrics |
getPageMetrics()
Returns the printer page metrics. |
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_ROTATION
public static final int ROTATE_90_DEGREES
public static final int ROTATE_180_DEGREES
public static final int ROTATE_270_DEGREES
Constructor Detail |
protected GraphicPrinter() throws PIOSException
PIOSException
- thrown if an error is detected while creating/
opening the printer connectionMethod Detail |
public abstract Metrics getPageMetrics() throws UnsupportedException, PrinterException
UnsupportedException
- thrown if page metrics is not supported by the printer
PrinterException
- thrown if an error occurs while getting the page size informationpublic abstract void drawText(PrinterFont font, float x, float y, java.lang.String text, int rotate) throws UnsupportedException, PrinterException
font
- the text fontx
- the coordinate along horizontal axisy
- the coordinate along vertical axistext
- the text to drawrotate
- the field rotation
UnsupportedException
- thrown if rotation is not supported by the printer
PrinterException
- thrown if an error occurs while drawing the textpublic abstract void drawBarcode(PrinterBarcode barcode, float x, float y, byte[] data, int rotate) throws UnsupportedException, PrinterException
barcode
- - the PrinterBarcode object that include information of symbology and printing optionsx
- the coordinate along horizontal axisy
- the coordinate along vertical axisdata
- the data that will be encoded in barcoderotate
- the field rotation
UnsupportedException
- thrown if rotation is not supported by the printer
PrinterException
- thrown if an error occurs while drawing the barcodecom.sap.ip.me.api.pios.symbology
public abstract void drawImage(java.lang.String name, float x, float y, int rotate) throws UnsupportedException, PrinterException
name
- the name of the image stored at the printer's memoryx
- the coordinate along horizontal axisy
- the coordinate along vertical axisrotate
- the field rotation
UnsupportedException
- thrown if rotation is not supported by the printer
PrinterException
- thrown if an error occurs while drawing the imagepublic abstract void drawLine(float x0, float y0, float x1, float y1, float thickness) throws UnsupportedException, PrinterException
x0
- the coordinate along horizontal axis for first pointy0
- the coordinate along vertical axis for first pointx1
- the coordinate along horizontal axis for second pointy1
- the coordinate along vertical axis for second pointthickness
- the thickness of the line in printer points
UnsupportedException
- thrown if line drawing is not supported by the printer
PrinterException
- thrown when invalid parameter values are usedpublic abstract void drawRectangle(float x, float y, float width, float height, float thickness) throws UnsupportedException, PrinterException
x
- the coordinate along horizontal axis for left most top rectangle cornery
- the coordinate along vertical axis for left most top rectangle cornerwidth
- the width of the rectangle in pointsheight
- the height of the rectangle in pointsthickness
- the thickness of the line in points
UnsupportedException
- thrown if line drawing is not supported by the printer
PrinterException
- thrown when invalid parameter values are usedpublic abstract void drawTransientImage(java.awt.Image img, float x, float y, int rotate) throws UnsupportedException, PrinterException
img
- the transient image to be printedx
- the coordinate along horizontal axisy
- the coordinate along vertical axisrotate
- the field rotation
UnsupportedException
- thrown if rotation or drawing transient images is not supported by the printer
PrinterException
- thrown if an error occurs while drawing the image
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |