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

[macosx] Printing attributes break page size set via "java.awt.print.Book" object

XMLWordPrintable

    • 2d
    • b14
    • os_x

        FULL PRODUCT VERSION :
        JDK 8u162 b12

        ADDITIONAL OS VERSION INFORMATION :
        OS X 10.11

        A DESCRIPTION OF THE PROBLEM :
        If "javax.print.attribute.PrintRequestAttributeSet" which contains at least one any printing attribute is transferred to "java.awt.print.PrinterJob.print(PrintRequestAttributeSet)" method, then a page size specified through "java.awt.print.Book" object associated with the printer job is not respected and the printed page size equals the default page size of the printer.

        For example, in the attached test case "PrintingAttributeBreaksBookPageSize.java" the printed page size should be exactly 4" x 6", while adding a single "javax.print.attribute.PrintRequestAttribute" leads to a much bigger size of the printed page. The difference is demonstrated in the attached following PDF files:
        - "PrintedPageWithCorrectSize.pdf" - correct page size.
        - "PrintedPageWithWrongSize.pdf" - incorrect page size.

        STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
        1. Configure a default printer for the system to use either a virtual printer, for example "PDF Printer Lite", "PDFwriter for Mac", or a printer capable of printing a page with 4" x 6" size.
        2. Compile and run the attached test case "PrintingAttributeBreaksBookPageSize.java" leaving the line "attributes.add(Chromaticity.MONOCHROME);" commented out.
        3. Notice that 4" x 6" page is properly printed.
        4. Uncomment the line "attributes.add(Chromaticity.MONOCHROME);", recompile and run the test case.
        5. Notice that the printed page size is different from the expected 4'' x 6'' and corresponds to the printer's default page size.

              alitvinov Anton Litvinov (Inactive)
              shadowbug Shadow Bug
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: