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

REGRESSION: pageDialog() mixes up margins for some printers in landscape

XMLWordPrintable

    • 2d
    • b26
    • x86
    • windows_98



      Name: jk109818 Date: 05/30/2002


      FULL PRODUCT VERSION :
      java version "1.4.0"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-b92)
      Java HotSpot(TM) Client VM (build 1.4.0-b92, mixed mode)



      FULL OPERATING SYSTEM VERSION :
      Windows 98 [Version 4.10.2222]


      A DESCRIPTION OF THE PROBLEM :
      Calling printerJob.pageDialog(pageFormat) returns incorrect
      pageFormat values for some printers (e.g. HP OfficeJet G85)
      when in landscape. In particular, the value of
      pageFormat.getImageableX() corresponds to the value the user
      entered in the native page setup dialog for the right
      (rather than left) margin and the value of
      pageFormat.getImageableY() corresponds to the value the user
      entered for the bottom (rather than top) margin.

      Other printers I have tested (e.g. Apple LaserWriter) do not
      exhibit this problem. In both cases, Java prints the
      landscape content rotated counter-clockwise from the
      portrait content, implying that x=left and y=top in both
      cases, which also corresponds to what's shown in the native
      page setup dialog picture.

      This is a regression since JDK 1.3.1, where it worked
      correctly. Also, unlike the native pageDialog, the JDK 1.4
      cross-platform pageDialog works correctly.

      The HP margins are reported as though the image thinks it
      will be printed in what Java calls REVERSE_LANDSCAPE.
      Indeed, when I print on the same printer with WordPad,
      specifying "landscape" does come out in what Java calls
      REVERSE_LANDSCAPE (content rotated clockwise from portrait).
      So maybe you are missing some kind of "landscape
      means clockwise" signal which other applications are able to
      detect. But I note that under JDK 1.3.1 you printed
      landscape counter-clockwise while correctly reporting (and
      printing) x=left and y=top, which is also what the JDK 1.4
      cross-platform pageDialog does, so going back to that would
      be the preferred solution.


      REGRESSION. Last worked in version 1.3.1

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1. Build and run program below
      2. Page setup dialog comes up
      3. Select an HP OJ G85 printer (or equivalent)
      4. Select "landscape"
      5. Enter left=1, right=2, top=3, bottom=4
      4. Note getImageableX() and getImageableY() values

      You can also run the JDK Font2DTest demo under 1.4 vs. 1.3.1
      and see the equivalent printed results.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      Expected:
      pageFormat.getImageableX() = 72.0 (1")
      pageFormat.getImageableY() = 216.0 (3")

      Actual:
      pageFormat.getImageableX() = 144.0 (2")
      pageFormat.getImageableY() = 288.0 (4")


      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import java.awt.print.*;

      public class Test {
      static public void main(String args[]) {
      PrinterJob pj = PrinterJob.getPrinterJob();
      PageFormat pf = pj.pageDialog(new PageFormat());
      System.out.println(pf.getImageableX()
      + " " + pf.getImageableY());
      }
      }

      ---------- END SOURCE ----------

      CUSTOMER WORKAROUND :
      Use JDK 1.3.1
      -or-
      Use JDK 1.4 cross-platform dialogs

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

      (Review ID: 145944)
      ======================================================================

            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: