Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8012381

[macosx] : Collation selection ignored when printing on MacOSX

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: 8
    • Fix Version/s: 7u40
    • Component/s: client-libs
    • Labels:
    • Subcomponent:
      2d
    • Introduced In Version:
      7u4
    • Resolved In Build:
      b30

      Backports

        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 ();
           }
        }

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  jgodinez Jennifer Godinez (Inactive)
                  Reporter:
                  prr Philip Race
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  3 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: