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

macOS: save as PDF does not work for PrinterJob.print(...) with attributes

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P4 P4
    • 11-pool
    • 11.0.16.1
    • client-libs
    • OS: macOS

      openjdk version "11.0.16.1" 2022-08-12 LTS
      OpenJDK Runtime Environment (build 11.0.16.1+1-LTS)
      OpenJDK 64-Bit Server VM (build 11.0.16.1+1-LTS, mixed mode)

    • 2d

      The issue is reproduced with jdk 11.0.16.1 and is not reproduced with jdk-11.0.2.

      Steps to reproduce:
      - Run the attached WrongPaperForBookPrintingTest class on macOS
      - Select Save as PDF on the print dialog
      - Type the pdf name and press Save button

      The page is not saved as PDF. It is sent to printer.

      The code uses `PrinterJob.print(...)` with attributes:
      ```
                  PrintRequestAttributeSet aset = new HashPrintRequestAttributeSet();
                  aset.add(Chromaticity.MONOCHROME);

                  if (job.printDialog()) {
                      job.print(aset); // print with attributes
                  }
      ```

      Changing `job.print(aset)` to `job.print()` allows to save the content to pdf

            prr Philip Race
            alexsch Alexandr Scherbatiy
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: