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

[macos] printing page range "page 2 to 2" or "page 2 to 4" on macOS leads to not print

XMLWordPrintable

    • 2d
    • In Review
    • generic
    • os_x

      ADDITIONAL SYSTEM INFORMATION :
      Java Version 17.0.5+8, macOS 12.6.1

      A DESCRIPTION OF THE PROBLEM :
      When on macOS you select a multi page document for printing, for example print "page 2 to 2" or "page 2 to 4, leads to not printing the selected pages at all. This happens as well as printing from swing and also when printing from Java FX.

      The error is located in the file java.desktop/macosx/native/libawt_lawt/awt/CPrinterJob.m on the tag jdk-17+35 in line 615:
      jobject page = (*env)->CallObjectMethod(env, jthis, jm_getPageFormat, 0); // AWT_THREADING Safe (!appKit)

      Instead there must be written:
      jobject page = (*env)->CallObjectMethod(env, jthis, jm_getPageFormat, firstPage); // AWT_THREADING Safe (!appKit)

      to fix the error.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Print a multi page document from swing or Java FX and select in the printing dialog a page range from "page 2 to 2".

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Page 2 from the multi page document is printed.
      ACTUAL -
        The selected page is not printed (empty page instead).

      FREQUENCY : always


            rkannathpari Renjith Kannath Pariyangad
            webbuggrp Webbug Group
            Votes:
            1 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated: