JDK-8012381 : [macosx] : Collation selection ignored when printing on MacOSX
  • Type: Bug
  • Component: client-libs
  • Sub-Component: 2d
  • Affected Version: 8
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2013-04-16
  • Updated: 2013-12-17
  • Resolved: 2013-06-03
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.
JDK 7 JDK 8
7u40 b30Fixed 8Fixed
Description
Run the following test on Mac. When the print dialog comes up select "Paper Handling"
from the menu and check "Collate Page" and print. Pages still print uncollated.

import java.awt.*;
import javax.swing.*;
import java.awt.print.*;
import javax.print.attribute.PrintRequestAttributeSet;
import javax.print.attribute.HashPrintRequestAttributeSet;
import javax.print.attribute.standard.DialogTypeSelection;
import javax.print.attribute.standard.SheetCollate;
import javax.print.attribute.standard.Copies;

public class SunTest implements Printable {

   public void startTestCase() {

        PrinterJob pj = PrinterJob.getPrinterJob();
        PrintRequestAttributeSet pras  = new HashPrintRequestAttributeSet();
        pras.add(DialogTypeSelection.NATIVE);
        pras.add(SheetCollate.COLLATED);
        pras.add(new Copies(2));
        pj.setPrintable(this);

        if (pj.printDialog(pras)) {
            try {
                pj.print(pras);
            } catch (Exception e) {
            }
        }
   }

public int print(Graphics g, PageFormat pf, int pageNo) throws PrinterException
{
    if (pageNo > 2) {
       return Printable.NO_SUCH_PAGE;
    } else {
        g.setColor(Color.black);
        Font fnt = new Font("Serif", Font.PLAIN, 32);   /* Cover page */
        g.setFont(fnt);
        g.drawString("Page no: "+Integer.toString(pageNo), 100, 200);
        return Printable.PAGE_EXISTS;
    }
}

   public static void main (String []Args) {
      SunTest st = new SunTest ();
      st.startTestCase ();
   }
}