If you change the page ranges (on OS X you can only set start and end page though) that isn't reflected in the returned jobSettings.
If you enter say start 1 and end 2 the code
PrinterJob pj = PrinterJob.createPrinterJob();
pj.showPrintDialog(stage);
System.out.println(pj.getJobSettings());
still prints:
Collation = UNCOLLATED
Copies = 1
Sides = ONE_SIDED
JobName = JavaFX Print Job
Page ranges = null
Print color = COLOR
Print quality = NORMAL
Print resolution = Feed res=300dpi. Cross Feed res=300dpi.
Paper source = Paper source : Automatic
Page layout = Paper=Paper: A3 size=297.0x420.0 MM Orient=PORTRAIT leftMargin=54.0 rightMargin=53.99969482421875 topMargin=54.0 bottomMargin=54.0009765625
Where "Print ranges = null" is the interesting part.
Also, if you set a page range from 1 to 2 before calling showPrintDialog(..) that setting isn't pre-selected in the dialog.
So it seems that the JobSettings' pageRanges are not used in any way?
This means that printing in your app will always have to print all pages and there is no way to only print one or a selection which severely limits printing support.
On Windows 8.1 the page ranges can't be changed at all (controls disabled) which is probably better since that doesn't give the user false hope that this is working.
I have found no mention in the JavaDoc that pageRange selection isn't implemented and I could not find an RFE or bug report on the matter.
If you enter say start 1 and end 2 the code
PrinterJob pj = PrinterJob.createPrinterJob();
pj.showPrintDialog(stage);
System.out.println(pj.getJobSettings());
still prints:
Collation = UNCOLLATED
Copies = 1
Sides = ONE_SIDED
JobName = JavaFX Print Job
Page ranges = null
Print color = COLOR
Print quality = NORMAL
Print resolution = Feed res=300dpi. Cross Feed res=300dpi.
Paper source = Paper source : Automatic
Page layout = Paper=Paper: A3 size=297.0x420.0 MM Orient=PORTRAIT leftMargin=54.0 rightMargin=53.99969482421875 topMargin=54.0 bottomMargin=54.0009765625
Where "Print ranges = null" is the interesting part.
Also, if you set a page range from 1 to 2 before calling showPrintDialog(..) that setting isn't pre-selected in the dialog.
So it seems that the JobSettings' pageRanges are not used in any way?
This means that printing in your app will always have to print all pages and there is no way to only print one or a selection which severely limits printing support.
On Windows 8.1 the page ranges can't be changed at all (controls disabled) which is probably better since that doesn't give the user false hope that this is working.
I have found no mention in the JavaDoc that pageRange selection isn't implemented and I could not find an RFE or bug report on the matter.
- duplicates
-
JDK-8093879 [Printing] PrintJob.printPage() never returns on Mac OS X
- Resolved