public final class PrinterData extends DeviceData
Application code does not need to explicitly release the
resources managed by each instance when those instances are no longer
required, and thus no dispose()
method is provided.
Printer
,
Printer.getPrinterList()
,
PrintDialog.open()
,
Printing snippets,
Sample code and further informationModifier and Type | Field and Description |
---|---|
static int |
ALL_PAGES
scope field value indicating that
all pages should be printed |
boolean |
collate
whether or not the printer should collate the printed paper
Note that this field may be controlled by the printer driver.
|
int |
copyCount
the number of copies to print.
|
java.lang.String |
driver
the printer driver
On Windows systems, this is the name of the driver (often "winspool").
|
int |
duplex
Single-sided or double-sided printing, expressed as one of the
following values:
SWT.DEFAULT
the default duplex value for the printer
DUPLEX_NONE
single-sided printing
DUPLEX_LONG_EDGE
double-sided printing as if bound on the long edge
DUPLEX_SHORT_EDGE
double-sided printing as if bound on the short edge
The default value is SWT.DEFAULT , meaning do not set a value;
use the printer's default duplex setting. |
static int |
DUPLEX_LONG_EDGE
duplex field value indicating
double-sided printing for binding on the long edge. |
static int |
DUPLEX_NONE
duplex field value indicating
single-sided printing. |
static int |
DUPLEX_SHORT_EDGE
duplex field value indicating
double-sided printing for binding on the short edge. |
int |
endPage
the end page of a page range, used when scope is PAGE_RANGE.
|
java.lang.String |
fileName
the name of the file to print to if printToFile is true.
|
static int |
LANDSCAPE
orientation field value indicating
landscape paper orientation |
java.lang.String |
name
the name of the printer
On Windows systems, this is the name of the 'device'.
|
int |
orientation
The orientation of the paper, which can be either PORTRAIT
or LANDSCAPE.
|
(package private) byte[] |
otherData
private, platform-specific data
On Windows, this contains a copy of the DEVMODE struct
returned from the
PrintDialog . |
static int |
PAGE_RANGE
scope field value indicating that
the range of pages specified by startPage and endPage
should be printed |
static int |
PORTRAIT
orientation field value indicating
portrait paper orientation |
boolean |
printToFile
whether or not the print job should go to a file
|
int |
scope
the scope of the print job, expressed as one of the following values:
ALL_PAGES
Print all pages in the current document
PAGE_RANGE
Print the range of pages specified by startPage and endPage
SELECTION
Print the current selection
|
static int |
SELECTION
scope field value indicating that
the current selection should be printed |
int |
startPage
the start page of a page range, used when scope is PAGE_RANGE.
|
debug, errors, objects, tracking
Constructor and Description |
---|
PrinterData()
Constructs an instance of this class that can be
used to print to the default printer.
|
PrinterData(java.lang.String driver,
java.lang.String name)
Constructs an instance of this class with the given
printer driver and printer name.
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
toString()
Returns a string containing a concise, human-readable
description of the receiver.
|
public java.lang.String driver
public java.lang.String name
public int scope
ALL_PAGES
PAGE_RANGE
SELECTION
public int startPage
public int endPage
public boolean printToFile
public java.lang.String fileName
public int copyCount
public boolean collate
public int orientation
public int duplex
SWT.DEFAULT
DUPLEX_NONE
DUPLEX_LONG_EDGE
DUPLEX_SHORT_EDGE
The default value is SWT.DEFAULT
, meaning do not set a value;
use the printer's default duplex setting.
A printer's default value is typically single-sided,
however it can default to double-sided in order to save paper.
public static final int ALL_PAGES
scope
field value indicating that
all pages should be printedpublic static final int PAGE_RANGE
scope
field value indicating that
the range of pages specified by startPage and endPage
should be printedpublic static final int SELECTION
scope
field value indicating that
the current selection should be printedpublic static final int PORTRAIT
orientation
field value indicating
portrait paper orientationpublic static final int LANDSCAPE
orientation
field value indicating
landscape paper orientationpublic static final int DUPLEX_NONE
duplex
field value indicating
single-sided printing.
This is also known as simplex printing.
public static final int DUPLEX_LONG_EDGE
duplex
field value indicating
double-sided printing for binding on the long edge.
For portrait orientation, the long edge is vertical. For landscape orientation, the long edge is horizontal.
This is also known as duplex printing.
public static final int DUPLEX_SHORT_EDGE
duplex
field value indicating
double-sided printing for binding on the short edge.
For portrait orientation, the short edge is horizontal. For landscape orientation, the short edge is vertical.
This is also known as duplex tumble printing.
byte[] otherData
PrintDialog
.
On GTK, this contains a copy of the print_settings and page_setup
returned from the PrintDialog
.
On OS X Carbon, this contains a copy of the PrintSettings and PageFormat
returned from the PrintDialog
.
This field is not currently used on the X/Window System.public PrinterData()
Printer.getDefaultPrinterData()