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

REGRESSION: Printerjob.defaultPage returns incorrect default page size

XMLWordPrintable

    • 2d
    • rc1
    • x86
    • windows_95



      Name: jk109818 Date: 12/03/2001


      java version "1.4.0-beta3"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-beta3-b84)
      Java HotSpot(TM) Client VM (build 1.4.0-beta3-b84, mexed mode)


      When running next program at a dutch version of Windows 95, with a standard
      printer that has A4 as standard paperformat, this program returns a paper size
      of 8.5x11 inch (letter I believe). I expected 210x297mm (A4), as previous
      version (JRE 1.3.1) did.

      import java.awt.print.PrinterJob;
      import java.awt.print.PageFormat;

      public class DefPaperSize {
          public static void main(String[] args) {
              double w_72dpi, w_i, w_mm;
              double h_72dpi, h_i, h_mm;

              // get default pageformat
              PrinterJob job = PrinterJob.getPrinterJob();
              PageFormat format = job.defaultPage();
              w_72dpi = format.getWidth(); // in 72dpi acc. API doc.
              h_72dpi = format.getHeight(); // in 72dpi acc. API doc.

              // calculate size in inches
              w_i = w_72dpi / 72.0;
              h_i = h_72dpi / 72.0;

              // calculate size in millimeters (mm)
              w_mm = w_i * 25.4;
              h_mm = h_i * 25.4;

              // output sizes
              System.out.println("Default Printer Page size");
              System.out.println("width = " + w_72dpi + "[72dpi] = "
                                            + w_i + " [inch] = "
                                            + w_mm + " [mm]");
              System.out.println("height = " + h_72dpi + "[72dpi] = "
                                             + h_i + " [inch] = "
                                             + h_mm + " [mm]");

              System.exit(0);
          }
      }

      Release Regression From : 1.3.1
      The above release value was the last known release where this
      bug was knwon to work. Since then there has been a regression.

      (Review ID: 135412)
      ======================================================================

            jgodinez Jennifer Godinez (Inactive)
            jkimsunw Jeffrey Kim (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: