new GC(printer)
and then draw on the printer GC using the usual graphics calls.
A Printer object may be constructed by providing
a PrinterData object which identifies the printer.
A PrintDialog presents a print dialog to the user
and returns an initialized instance of PrinterData.
Alternatively, calling new Printer() will construct a
printer object for the user's default printer.
Application code must explicitly invoke the Printer.dispose()
method to release the operating system resources managed by each instance
when those instances are no longer required.
PrinterData, PrintDialog, Printing snippets, Sample code and further information
| Modifier and Type | Field and Description |
|---|---|
| pack-priv long | |
| pack-priv PrinterData | |
| pack-priv static boolean | |
| pack-priv static int | |
| pack-priv static PrinterData | |
| pack-priv static long | |
| pack-priv static final String | |
| pack-priv static final String | |
| pack-priv boolean | isGCCreated
whether or not a GC was created for this printer |
| pack-priv long | |
| pack-priv long | |
| pack-priv static PrinterData[] | |
| pack-priv long | |
| pack-priv long | |
| pack-priv static byte[] | |
| pack-priv static int | |
| pack-priv long |
| Access | Constructor and Description |
|---|---|
| public | |
| public | Printer(PrinterData
the printer data for the specified printer, or null to use the default printer data)Constructs a new printer given a |
| Modifier and Type | Method and Description |
|---|---|
| public void | |
| pack-priv static DeviceData | |
| public Rectangle | Returns: a rectangle, relative to the client area's coordinates, that is the client area expanded by the printer's trim (or minimum margins)the x coordinate of the client area x, int the y coordinate of the client area y, int the width of the client area width, int the height of the client area height)Given a client area (as described by the arguments), returns a rectangle, relative to the client area's coordinates, that is the client area expanded by the printer's trim (or minimum margins). |
| protected void | create(DeviceData
the device data deviceData)Overrides org. |
| protected void | |
| public void | |
| public void | |
| public Rectangle | Returns: the bounding rectangleOverrides org. |
| public Rectangle | Returns: the client area |
| public static PrinterData | Returns: the default printer data or nullReturns a |
| public Point | Returns: the horizontal and vertical DPIOverrides org. |
| pack-priv Point | |
| public PrinterData | Returns: a PrinterData object describing the receiverReturns a |
| public static PrinterData[] | Returns: an array of PrinterData objects representing the available printersReturns an array of |
| pack-priv static void | |
| pack-priv static long | |
| pack-priv static long | |
| pack-priv static long | |
| pack-priv static long | |
| protected void | init()
Overrides org. |
| public void | internal_dispose_GC(long
the platform specific GC handle hDC, GCData the platform specific GC data data)Implements abstract org. Implements org. |
| public long | Returns: the platform specific GC handlethe platform specific GC data data)Implements abstract org. Implements org. |
| public boolean | isAutoScalable()
Overrides default org. true iff coordinates can be auto-scaled on this
drawable and false if not.
|
| pack-priv static PrinterData | |
| pack-priv static void | |
| pack-priv static boolean | |
| pack-priv static byte[] | |
| pack-priv static double | |
| pack-priv static int | |
| public boolean | |
| public boolean | Returns: true if the page started successfully and false otherwise.Starts a page and returns true if the page started successfully and false otherwise. |
| pack-priv static byte[] |
| cairo | back to summary |
|---|---|
| pack-priv long cairo | |
| data | back to summary |
|---|---|
| pack-priv PrinterData data | |
| disablePrinting | back to summary |
|---|---|
| pack-priv static boolean disablePrinting | |
| end | back to summary |
|---|---|
| pack-priv static int end | |
| findData | back to summary |
|---|---|
| pack-priv static PrinterData findData | |
| findPrinter | back to summary |
|---|---|
| pack-priv static long findPrinter | |
| GTK_FILE_BACKEND | back to summary |
|---|---|
| pack-priv static final String GTK_FILE_BACKEND | |
| GTK_LPR_BACKEND | back to summary |
|---|---|
| pack-priv static final String GTK_LPR_BACKEND | |
| isGCCreated | back to summary |
|---|---|
| pack-priv boolean isGCCreated whether or not a GC was created for this printer | |
| pageSetup | back to summary |
|---|---|
| pack-priv long pageSetup | |
| printer | back to summary |
|---|---|
| pack-priv long printer | |
| printerList | back to summary |
|---|---|
| pack-priv static PrinterData[] printerList | |
| printJob | back to summary |
|---|---|
| pack-priv long printJob | |
| settings | back to summary |
|---|---|
| pack-priv long settings | |
| settingsData | back to summary |
|---|---|
| pack-priv static byte[] settingsData | |
| start | back to summary |
|---|---|
| pack-priv static int start | |
| surface | back to summary |
|---|---|
| pack-priv long surface | |
| Printer | back to summary |
|---|---|
| public Printer() Constructs a new printer representing the default printer. Note You must dispose the printer when it is no longer required.
| |
| Printer | back to summary |
|---|---|
| public Printer(PrinterData data) Constructs a new printer given a Note You must dispose the printer when it is no longer required.
| |
| cancelJob | back to summary |
|---|---|
| public void cancelJob() Cancels a print job in progress.
| |
| checkNull | back to summary |
|---|---|
| pack-priv static DeviceData checkNull(PrinterData data) | |
| computeTrim | back to summary |
|---|---|
| public Rectangle computeTrim(int x, int y, int width, int height) Given a client area (as described by the arguments), returns a rectangle, relative to the client area's coordinates, that is the client area expanded by the printer's trim (or minimum margins). Most printers have a minimum margin on each edge of the paper where the printer device is unable to print. This margin is known as the "trim." This method can be used to calculate the printer's minimum margins by passing in a client area of 0, 0, 0, 0 and then using the resulting x and y coordinates (which will be <= 0) to determine the minimum margins for the top and left edges of the paper, and the resulting width and height (offset by the resulting x and y) to determine the minimum margins for the bottom and right edges of the paper, as follows:
| |
| create | back to summary |
|---|---|
| protected void create(DeviceData deviceData) Overrides org. Creates the printer handle.
This method is called internally by the instance creation
mechanism of the
| |
| destroy | back to summary |
|---|---|
| protected void destroy() Overrides org. Destroys the printer handle.
This method is called internally by the dispose
mechanism of the
| |
| endJob | back to summary |
|---|---|
| public void endJob() Ends the current print job.
| |
| endPage | back to summary |
|---|---|
| public void endPage() Ends the current page.
| |
| getBounds | back to summary |
|---|---|
| public Rectangle getBounds() Overrides org. Returns a rectangle describing the receiver's size and location. For a printer, this is the size of the physical page, in pixels.
| |
| getClientArea | back to summary |
|---|---|
| public Rectangle getClientArea() Overrides org. Returns a rectangle which describes the area of the receiver which is capable of displaying data. For a printer, this is the size of the printable area of the page, in pixels.
| |
| getDefaultPrinterData | back to summary |
|---|---|
| public static PrinterData getDefaultPrinterData() Returns a
| |
| getDPI | back to summary |
|---|---|
| public Point getDPI() Overrides org. Returns a point whose x coordinate is the horizontal dots per inch of the printer, and whose y coordinate is the vertical dots per inch of the printer.
| |
| getIndependentDPI | back to summary |
|---|---|
| pack-priv Point getIndependentDPI() | |
| getPrinterData | back to summary |
|---|---|
| public PrinterData getPrinterData() Returns a
| |
| getPrinterList | back to summary |
|---|---|
| public static PrinterData[] getPrinterList() Returns an array of
| |
| gtk_init | back to summary |
|---|---|
| pack-priv static void gtk_init() | |
| gtkPrinterFromPrinterData | back to summary |
|---|---|
| pack-priv static long gtkPrinterFromPrinterData(PrinterData data) | |
| GtkPrinterFunc_Default | back to summary |
|---|---|
| pack-priv static long GtkPrinterFunc_Default(long printer, long user_data) | |
| GtkPrinterFunc_FindNamedPrinter | back to summary |
|---|---|
| pack-priv static long GtkPrinterFunc_FindNamedPrinter(long printer, long user_data) | |
| GtkPrinterFunc_List | back to summary |
|---|---|
| pack-priv static long GtkPrinterFunc_List(long printer, long user_data) | |
| init | back to summary |
|---|---|
| protected void init() Overrides org. Initializes any internal resources needed by the device.
This method is called after
If subclasses reimplement this method, they must
call the | |
| internal_dispose_GC | back to summary |
|---|---|
| public void internal_dispose_GC(long hDC, GCData data) Implements abstract org. Implements org. Invokes platform specific functionality to dispose a GC handle. Important Note This method is not part of the public
API for | |
| internal_new_GC | back to summary |
|---|---|
| public long internal_new_GC(GCData data) Implements abstract org. Implements org. Invokes platform specific functionality to allocate a new GC handle. Important Note This method is not part of the public
API for | |
| isAutoScalable | back to summary |
|---|---|
| public boolean isAutoScalable() Overrides default org. Doc from org. Returns
| |
| printerDataFromGtkPrinter | back to summary |
|---|---|
| pack-priv static PrinterData printerDataFromGtkPrinter(long printer) | |
| restore | back to summary |
|---|---|
| pack-priv static void restore(byte[] data, long settings, long page_setup) | |
| restoreBoolean | back to summary |
|---|---|
| pack-priv static boolean restoreBoolean(String key) | |
| restoreBytes | back to summary |
|---|---|
| pack-priv static byte[] restoreBytes(String key, boolean nullTerminate) | |
| restoreDouble | back to summary |
|---|---|
| pack-priv static double restoreDouble(String key) | |
| restoreInt | back to summary |
|---|---|
| pack-priv static int restoreInt(String key) | |
| startJob | back to summary |
|---|---|
| public boolean startJob(String jobName) Starts a print job and returns true if the job started successfully and false otherwise. This must be the first method called to initiate a print job, followed by any number of startPage/endPage calls, followed by endJob. Calling startPage, endPage, or endJob before startJob will result in undefined behavior.
| |
| startPage | back to summary |
|---|---|
| public boolean startPage() Starts a page and returns true if the page started successfully and false otherwise. After calling startJob, this method may be called any number of times along with a matching endPage.
| |
| uriFromFilename | back to summary |
|---|---|
| pack-priv static byte[] uriFromFilename(String filename) | |