Top Description Fields Constructors Methods
javafx.print

public final Class JobSettings

extends Object
Class Inheritance
Imports
java.util.Set, javafx.beans.property.IntegerProperty, .ObjectProperty, .Property, .SimpleIntegerProperty, .SimpleObjectProperty, .SimpleStringProperty, .StringProperty, javafx.beans.value.ObservableValue

The JobSettings class encapsulates most of the configuration of a print job. Applications do not - and cannot - directly create or set a JobSettings instance. One is already installed on the print job when it is created.

As documented on PrinterJob, the JobSettings installed on that job will initially reflect the current default settings for the initially associated printer for that job.

The JobSettings delegate then remains the same for the life of the job, and will have it's member properties updated to be compatible with a change in Printer on the job. For example as a result of a user interaction via a platform's dialog. An incompatible setting will usually cause the setting to revert to the default for the new printer.

Any implicit or explicit updates to settings resulting from the user interaction with dialog will be propagated and visible to the application once the user approves the settings by dismissing the dialog using its "accept" option.

For most printing applications it is likely sufficient to let the user set the desired options and have these propagated to the job. For applications which need them, there are setter and getter methods for the individual options, which are also available as properties, and change in values of settings may be monitored and updated via these properties.

Not all values of settings are available on all printers. For example a printer may not support two-sided printing. See the Printer class for how to to determine supported settings.

Since
JavaFX 8.0

Field Summary

Modifier and TypeField and Description
private ObjectProperty<Collation>
private ObjectProperty<PrintColor>
private IntegerProperty
private static final String
private boolean
private boolean
private boolean
private boolean
private boolean
private boolean
private boolean
private boolean
private boolean
private boolean
private boolean
private boolean
private boolean
private boolean
private boolean
private boolean
private PrinterJob
private SimpleStringProperty
private ObjectProperty<PageLayout>
private Collation
private int
private PageLayout
private PaperSource
private PrintColor
private PrintQuality
private PrintResolution
private PrintSides
private SimpleStringProperty
private ObjectProperty<PageRange[]>
private ObjectProperty<PaperSource>
private Printer
private PrinterAttributes
private ObjectProperty<PrintQuality>
private ObjectProperty<PrintResolution>
private ObjectProperty<PrintSides>

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public final ObjectProperty<Collation>

Returns:

an instance of Collation
collationProperty
()

Property representing an instance of Collation.

public final IntegerProperty

Returns:

the number of copies of the job to print
copiesProperty
()

IntegerProperty representing the number of copies of the job to print.

public final Collation
public final int
public final String
public final String
public final PageLayout
public final PageRange[]
public final PaperSource
public final PrintColor
public final PrintQuality
public final PrintResolution
public final PrintSides
private boolean
public final StringProperty

Returns:

the name of a job
jobNameProperty
()

StringProperty representing the name of a job.

public final StringProperty

Returns:

the name of a printer spool file
outputFileProperty
()

A StringProperty representing the name of a filesystem file, to which the platform printer driver should spool the rendered print data.

public final ObjectProperty<PageLayout>

Returns:

an instance of PageLayout
pageLayoutProperty
()

Property representing an instance of PageLayout.

public final ObjectProperty<T>

Returns:

the value presents the job pages to print as an array of PageRange
pageRangesProperty
()

An ObjectProperty whose value represents the job pages to print as an array of PageRange.

public final ObjectProperty<PaperSource>

Returns:

an instance of PaperSource
paperSourceProperty
()

Property representing an instance of PaperSource.

public final ObjectProperty<PrintColor>

Returns:

an instance of PrintColor
printColorProperty
()

Property representing an instance of PrintColor.

public final ObjectProperty<PrintQuality>

Returns:

an instance of PrintQuality
printQualityProperty
()

Property representing an instance of PrintQuality.

public final ObjectProperty<PrintResolution>

Returns:

an instance of PrintResolution
printResolutionProperty
()

Property representing an instance of PrintResolution.

public final ObjectProperty<PrintSides>

Returns:

an instance of PrintSides
printSidesProperty
()

Property representing an instance of PrintSides.

public final void
public final void
setCopies(int nCopies)

public final void
public final void
public final void
public final void
setPageRanges(PageRange...
null or a varargs array as specified above
pages
)

The range of pages to print as an array of PageRange.

public final void
public final void
pack-priv void
public final void
public final void
public final void
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

pack-priv void
updateForPrinter(Printer printer)

If any settings are incompatible with the specified printer, they are updated to be compatible.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

collationback to summary
private ObjectProperty<Collation> collation
colorback to summary
private ObjectProperty<PrintColor> color
copiesback to summary
private IntegerProperty copies
DEFAULT_JOBNAMEback to summary
private static final String DEFAULT_JOBNAME
defaultCollationback to summary
private boolean defaultCollation
defaultCopiesback to summary
private boolean defaultCopies
defaultPageLayoutback to summary
private boolean defaultPageLayout
defaultPaperSourceback to summary
private boolean defaultPaperSource
defaultPrintColorback to summary
private boolean defaultPrintColor
defaultPrintQualityback to summary
private boolean defaultPrintQuality
defaultPrintResolutionback to summary
private boolean defaultPrintResolution
defaultSidesback to summary
private boolean defaultSides
hasOldCollationback to summary
private boolean hasOldCollation
hasOldCopiesback to summary
private boolean hasOldCopies
hasOldPageLayoutback to summary
private boolean hasOldPageLayout
hasOldPaperSourceback to summary
private boolean hasOldPaperSource
hasOldPrintColorback to summary
private boolean hasOldPrintColor
hasOldPrintQualityback to summary
private boolean hasOldPrintQuality
hasOldPrintResolutionback to summary
private boolean hasOldPrintResolution
hasOldSidesback to summary
private boolean hasOldSides
jobback to summary
private PrinterJob job
jobNameback to summary
private SimpleStringProperty jobName
layoutback to summary
private ObjectProperty<PageLayout> layout
oldCollationback to summary
private Collation oldCollation
oldCopiesback to summary
private int oldCopies
oldPageLayoutback to summary
private PageLayout oldPageLayout
oldPaperSourceback to summary
private PaperSource oldPaperSource
oldPrintColorback to summary
private PrintColor oldPrintColor
oldPrintQualityback to summary
private PrintQuality oldPrintQuality
oldPrintResolutionback to summary
private PrintResolution oldPrintResolution
oldSidesback to summary
private PrintSides oldSides
outputFileback to summary
private SimpleStringProperty outputFile
pageRangesback to summary
private ObjectProperty<PageRange[]> pageRanges
paperSourceback to summary
private ObjectProperty<PaperSource> paperSource
printerback to summary
private Printer printer
printerCapsback to summary
private PrinterAttributes printerCaps
qualityback to summary
private ObjectProperty<PrintQuality> quality
resolutionback to summary
private ObjectProperty<PrintResolution> resolution
sidesback to summary
private ObjectProperty<PrintSides> sides

Constructor Detail

JobSettingsback to summary
pack-priv JobSettings(Printer printer)

Method Detail

collationPropertyback to summary
public final ObjectProperty<Collation> collationProperty()

Property representing an instance of Collation. Collation determines how sheets are sorted when multiple copies of a document are printed. As such it is only relevant if 2 or more copies of a document with 2 more sheets are printed. A sheet is the physical media, so documents with 2 pages that are printed N-up, or double-sided may still have only one sheet. A collated print job produces documents with sheets of a document sorted in sequence. An uncollated job collects together the multiple copies of the same sheet. Uncollated (false) is the typical default value.

Returns:ObjectProperty<Collation>

an instance of Collation

copiesPropertyback to summary
public final IntegerProperty copiesProperty()

IntegerProperty representing the number of copies of the job to print.

Returns:IntegerProperty

the number of copies of the job to print

getCollationback to summary
public final Collation getCollation()
getCopiesback to summary
public final int getCopies()
getJobNameback to summary
public final String getJobName()
getOutputFileback to summary
public final String getOutputFile()
getPageLayoutback to summary
public final PageLayout getPageLayout()
getPageRangesback to summary
public final PageRange[] getPageRanges()
getPaperSourceback to summary
public final PaperSource getPaperSource()
getPrintColorback to summary
public final PrintColor getPrintColor()
getPrintQualityback to summary
public final PrintQuality getPrintQuality()
getPrintResolutionback to summary
public final PrintResolution getPrintResolution()
getPrintSidesback to summary
public final PrintSides getPrintSides()
isJobNewback to summary
private boolean isJobNew()
jobNamePropertyback to summary
public final StringProperty jobNameProperty()

StringProperty representing the name of a job.

Returns:StringProperty

the name of a job

outputFilePropertyback to summary
public final StringProperty outputFileProperty()

A StringProperty representing the name of a filesystem file, to which the platform printer driver should spool the rendered print data.

Applications can use this to programmatically request print-to-file behavior where the native print system is capable of spooling the output to a filesystem file, rather than the printer device.

This is often useful where the printer driver generates a format such as Postscript or PDF, and the application intends to distribute the result instead of printing it, or for some other reason the application does not want physical media (paper) emitted by the printer.

The default value is an empty string, which is interpreted as unset, equivalent to null, which means output is sent to the printer. So in order to reset to print to the printer, clear the value of this property by setting it to null or an empty string.

Additionally if the application displays a printer dialog which allows the user to specify a file destination, including altering an application specified file destination, the value of this property will reflect that user-specified choice, including clearing it to reset to print to the printer, if the user does so.

If the print system does not support print-to-file, then this setting will be ignored.

If the specified name specifies a non-existent path, or does not specify a user writable file, when printing the results are platform-dependent. Possible behaviours might include replacement with a default output file location, printing to the printer instead, or a platform printing error.

Returns:StringProperty

the name of a printer spool file

Default Value
an empty string
Since
17
pageLayoutPropertyback to summary
public final ObjectProperty<PageLayout> pageLayoutProperty()

Property representing an instance of PageLayout. Setting a null value is ignored.

Returns:ObjectProperty<PageLayout>

an instance of PageLayout

pageRangesPropertyback to summary
public final ObjectProperty<T> pageRangesProperty()

An ObjectProperty whose value represents the job pages to print as an array of PageRange. A null values mean print all pages. Otherwise it must be a non-overlapping array of PageRange instances ordered in increasing page number. Page numbers start from 1 (one). An empty array is considered equivalent to a null array.

An illegal or unsupported (by the printer) set of page ranges will be ignored.

Ranges which exceed beyond the number of pages imaged by the job during printing do not cause any error.

Returns:ObjectProperty<T>

the value presents the job pages to print as an array of PageRange

paperSourcePropertyback to summary
public final ObjectProperty<PaperSource> paperSourceProperty()

Property representing an instance of PaperSource. A null value is ignored.

Returns:ObjectProperty<PaperSource>

an instance of PaperSource

printColorPropertyback to summary
public final ObjectProperty<PrintColor> printColorProperty()

Property representing an instance of PrintColor. If a null value is set it is ignored.

Returns:ObjectProperty<PrintColor>

an instance of PrintColor

printQualityPropertyback to summary
public final ObjectProperty<PrintQuality> printQualityProperty()

Property representing an instance of PrintQuality.

Note that quality and resolution are overlapping concepts. Therefore a printer may support setting one, or the other but not both. Applications setting these programmatically should query both properties and select appropriately from the supported values. If a printer supports non-standard values, code likely cannot distinguish the printer's interpretation of these values and it is safest to stick to selecting a standard value that matches the requirement.

Returns:ObjectProperty<PrintQuality>

an instance of PrintQuality

printResolutionPropertyback to summary
public final ObjectProperty<PrintResolution> printResolutionProperty()

Property representing an instance of PrintResolution. A null value is ignored.

Note that quality and resolution are overlapping concepts. Therefore a printer may support setting one, or the other but not both. Applications setting these programmatically should query both properties and select appropriately from the supported values. If a printer supports non-standard values, code likely cannot distinguish the printer's interpretation of these values and it is safest to stick to selecting a standard value that matches the requirement.

Returns:ObjectProperty<PrintResolution>

an instance of PrintResolution

printSidesPropertyback to summary
public final ObjectProperty<PrintSides> printSidesProperty()

Property representing an instance of PrintSides.

Returns:ObjectProperty<PrintSides>

an instance of PrintSides

setCollationback to summary
public final void setCollation(Collation collation)
setCopiesback to summary
public final void setCopies(int nCopies)
setJobNameback to summary
public final void setJobName(String name)
setOutputFileback to summary
public final void setOutputFile(String filePath)
setPageLayoutback to summary
public final void setPageLayout(PageLayout pageLayout)
setPageRangesback to summary
public final void setPageRanges(PageRange... pages)

The range of pages to print as an array of PageRange. The use of varargs means the common case of a single range can be auto-boxed. ((PageRange[])null) always means all pages however since this is the default it is less likely to be used. See pageRangesProperty for more details.

Parameters
pages:PageRange[]

null or a varargs array as specified above

setPaperSourceback to summary
public final void setPaperSource(PaperSource value)
setPrintColorback to summary
public final void setPrintColor(PrintColor color)
setPrinterJobback to summary
pack-priv void setPrinterJob(PrinterJob job)
setPrintQualityback to summary
public final void setPrintQuality(PrintQuality quality)
setPrintResolutionback to summary
public final void setPrintResolution(PrintResolution resolution)
setPrintSidesback to summary
public final void setPrintSides(PrintSides sides)
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

a string representation of the object

Annotations
@Override
updateForPrinterback to summary
pack-priv void updateForPrinter(Printer printer)

If any settings are incompatible with the specified printer, they are updated to be compatible. This method could be useful as a public one.