JDK-8061258 : [macosx] PrinterJob's native Print Dialog does not reflect specified Copies or Page Ranges
  • Type: Bug
  • Component: client-libs
  • Sub-Component: 2d
  • Affected Version: 7u11,8u76,9
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2014-10-16
  • Updated: 2018-02-08
  • Resolved: 2016-03-30
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
8u131Fixed 9 b116Fixed
Related Reports
Duplicate :  
JDK 7u11 and JDK 9 b34 both have the same issue that attempts to pre-populate the native
dialog with copies and page ranges fail.
Test below :-
import javax.print.*;
import javax.print.attribute.*;
import javax.print.attribute.standard.*;
import java.awt.*;
import java.awt.print.*;

public class DlgAttrsBug implements Printable {

    public static void main(String args[]) throws Exception {
        PrinterJob job = PrinterJob.getPrinterJob();
        if (job.getPrintService() == null) {
           System.out.println("No printers. Test cannot continue.");
        job.setPrintable(new DlgAttrsBug());
        PrintRequestAttributeSet aset = new HashPrintRequestAttributeSet();
        aset.add(new Copies(2));
        aset.add(new PageRanges(3,4));
        if (job.printDialog(aset)) {

    public int print(Graphics g, PageFormat pf, int pi)
                     throws PrinterException  {

        if (pi >= 5) {
            return NO_SUCH_PAGE;

        g.drawString("Page : " + (pi+1), 200, 200);

        return PAGE_EXISTS;
Added 8u76 to affected version as per bug closed as duplicate

osx native code was calling getNumberOfPages() and since it is -1, then "All" radio button is selected. We were not using the selection attributes to determine which radio button to select. The fix is to get the selection attribute and based on that , mark which radio button ALL/Pages to select. If no selection is done by the user, then get the from page and to page and check if from > min and to < max which would suggest user has requested explicit setting of PageRanges so select "Pages" radio button. BTW, Copies settings was getting prepopulated already maybe due to some other fix. This fix was only for Pageranges.

RULE AWT_Printing/Manual/AttributeChange_Native/AttributeChange_NativeTest.html Exception java.lang.RuntimeException: <br><br>One/some of the attributes are not set properly. Pl. refer to user remarks for details <br>One/some of the attributes are not set properly. Pl. refer to user remarks for details RULE AWT_Printing/Manual/AttributeChange_Native/AttributeChange_NativeTest.html ExitCode 97