Top Description Fields Constructors Methods
org.eclipse.swt.printing

public final Class PrinterData

extends DeviceData
Class Inheritance
Imports
org.eclipse.swt.*, org.eclipse.swt.graphics.*

Instances of this class are descriptions of a print job in terms of the printer, and the scope and type of printing that is desired. For example, the number of pages and copies can be specified, as well as whether or not the print job should go to a file.

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.

See Also
Printer, Printer#getPrinterList, PrintDialog#open, Printing snippets, Sample code and further information

Field Summary

Modifier and TypeField and Description
public static final int
ALL_PAGES

scope field value indicating that all pages should be printed

public boolean
collate

whether or not the printer should collate the printed paper Note that this field may be controlled by the printer driver.

public int
copyCount

the number of copies to print.

public String
driver

the printer driver On Windows systems, this is the name of the driver (often "winspool").

public 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
public static final int
DUPLEX_LONG_EDGE

duplex field value indicating double-sided printing for binding on the long edge.

public static final int
DUPLEX_NONE

duplex field value indicating single-sided printing.

public static final int
DUPLEX_SHORT_EDGE

duplex field value indicating double-sided printing for binding on the short edge.

public int
endPage

the end page of a page range, used when scope is PAGE_RANGE.

public String
fileName

the name of the file to print to if printToFile is true.

public static final int
LANDSCAPE

orientation field value indicating landscape paper orientation

public String
name

the name of the printer On Windows systems, this is the name of the 'device'.

public int
orientation

The orientation of the paper, which can be either PORTRAIT or LANDSCAPE.

pack-priv byte[]
otherData

private, platform-specific data On Windows, this contains a copy of the DEVMODE struct returned from the PrintDialog.

public static final int
PAGE_RANGE

scope field value indicating that the range of pages specified by startPage and endPage should be printed

public static final int
PORTRAIT

orientation field value indicating portrait paper orientation

public boolean
printToFile

whether or not the print job should go to a file

public 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
public static final int
SELECTION

scope field value indicating that the current selection should be printed

public int
startPage

the start page of a page range, used when scope is PAGE_RANGE.

Inherited from org.eclipse.swt.graphics.DeviceData:
application_classapplication_namedebugdisplay_nameerrorsobjectstracking

Constructor Summary

AccessConstructor and Description
public
PrinterData()

Constructs an instance of this class that can be used to print to the default printer.

public
PrinterData(String
the printer driver for the printer
driver
,
String
the name of the printer
name
)

Constructs an instance of this class with the given printer driver and printer name.

Method Summary

Modifier and TypeMethod and Description
public String

Returns:

a string representation of the receiver
toString
()

Overrides java.lang.Object.toString.

Returns a string containing a concise, human-readable description of the receiver.

Field Detail

ALL_PAGESback to summary
public static final int ALL_PAGES

scope field value indicating that all pages should be printed

collateback to summary
public boolean collate

whether or not the printer should collate the printed paper Note that this field may be controlled by the printer driver. In other words, the printer itself may be capable of doing the collation, and if so, the value of this field will always be false.

copyCountback to summary
public int copyCount

the number of copies to print. Note that this field may be controlled by the printer driver In other words, the printer itself may be capable of printing multiple copies, and if so, the value of this field will always be 1.

driverback to summary
public String driver

the printer driver On Windows systems, this is the name of the driver (often "winspool"). On Mac OSX, this is the destination type ("Printer", "Fax", "File", or "Preview"). On X/Window systems, this is the name of a display connection to the Xprt server (the default is ":1"). On GTK+, this is the backend type name (eg. GtkPrintBackendCups).

duplexback to summary
public 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. A printer's default value is typically single-sided, however it can default to double-sided in order to save paper.

Since
3.7
DUPLEX_LONG_EDGEback to summary
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.

Since
3.7
DUPLEX_NONEback to summary
public static final int DUPLEX_NONE

duplex field value indicating single-sided printing.

This is also known as simplex printing.

Since
3.7
DUPLEX_SHORT_EDGEback to summary
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.

Since
3.7
endPageback to summary
public int endPage

the end page of a page range, used when scope is PAGE_RANGE. This value can be from 1 to the maximum number of pages for the platform.

fileNameback to summary
public String fileName

the name of the file to print to if printToFile is true. Note that this field is ignored if printToFile is false.

LANDSCAPEback to summary
public static final int LANDSCAPE

orientation field value indicating landscape paper orientation

Since
3.5
nameback to summary
public String name

the name of the printer On Windows systems, this is the name of the 'device'. On Mac OSX, X/Window systems, and GTK+, this is the printer's 'name'.

orientationback to summary
public int orientation

The orientation of the paper, which can be either PORTRAIT or LANDSCAPE.

Since
3.5
otherDataback to summary
pack-priv byte[] otherData

private, platform-specific data On Windows, this contains a copy of the DEVMODE struct returned from the PrintDialog. On GTK, this contains a copy of the print_settings and page_setup returned from the PrintDialog. On OS X Cocoa, this contains a copy of the PrintSettings and PageFormat returned from the PrintDialog. This field is not currently used on the X/Window System.

PAGE_RANGEback to summary
public static final int PAGE_RANGE

scope field value indicating that the range of pages specified by startPage and endPage should be printed

PORTRAITback to summary
public static final int PORTRAIT

orientation field value indicating portrait paper orientation

Since
3.5
printToFileback to summary
public boolean printToFile

whether or not the print job should go to a file

scopeback to summary
public 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
SELECTIONback to summary
public static final int SELECTION

scope field value indicating that the current selection should be printed

startPageback to summary
public int startPage

the start page of a page range, used when scope is PAGE_RANGE. This value can be from 1 to the maximum number of pages for the platform.

Constructor Detail

PrinterDataback to summary
public PrinterData()

Constructs an instance of this class that can be used to print to the default printer.

See Also
Printer#getDefaultPrinterData
PrinterDataback to summary
public PrinterData(String driver, String name)

Constructs an instance of this class with the given printer driver and printer name.

Parameters
driver:String

the printer driver for the printer

name:String

the name of the printer

See Also
driver, name

Method Detail

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Returns a string containing a concise, human-readable description of the receiver.

Returns:String

a string representation of the receiver

Annotations
@Override