Java Solaris Communities Sun Store Join SDN My Profile Why Join?
 
Bug Database
Bug Detail
Quick Lists
Top 25 Bugs
Top 25 RFE's
Recently Closed Bugs
Printable Page Printable Page


Bug Database
Bug ID: 4694478
Votes 7
Synopsis REGRESSION: pageDialog() mixes up margins for some printers in landscape
Category java:classes_2d
Reported Against 1.4
Release Fixed 1.5(tiger-b26)
State 10-Fix Delivered, bug
Priority: 3-Medium
Related Bugs
Submit Date 30-MAY-2002
Description




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  xxxxx  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) 
======================================================================
Work Around
N/A
Evaluation
=========================

This only affects drivers that has 270 degree rotation for landscape.

Changes made to fix for 4299145 introduced this problem.

 xxxxx@xxxxx  2002-08-27
====================================

In fixing 4299145, x and y values are switched to take into account the landscape rotation but the PageFormat orientation remained LANDSCAPE regardless if it's 90 or 270 degree rotation. 

 xxxxx@xxxxx  2003-09-23
======================================

Margins are set to 270 degree but still printed in 90 degrees. Updating of margin was done in the PageFormat returned by pageDialog so the user gets wrong values.  Fix: moved the change of margins inside RasterPrinterJob during printing and changed the printing direction to 270 for 270-degree devices.

 xxxxx@xxxxx  2003-10-08
Comments
  
  Include a link with my name & email   

Submitted On 26-APR-2003
phawkins
I have an HP ink jet printer that has exhibits this problem, so 
this isn't some obscure situation.  Are you going to fix this or 
what!?!


Submitted On 28-AUG-2003
adamgawnecain
The page dialog also mixes up margins when there is no 
printer installed, so you can't blame printer drivers.

My guess is that the bug is in building a new PageFormat 
object while processing the OK button (the margin fields seem 
to be initialized correctly).  But I dont have source code for 
sun.awt.windows.WPrinterJob so I cannot confirm this.


Submitted On 05-OCT-2004
Stefanebe
Still not resolved in 1.5.0 at least for Canons300 and Kyocera F-1200S.


Submitted On 19-OCT-2004
bleachga1
This still isn


Submitted On 19-OCT-2004
bleachga1
This still is not fixed on an HP OfficeJet G85 and G95.  It makes it impossible to use the native Page Settings dialog and store/retrieve the settings.



PLEASE NOTE: JDK6 is formerly known as Project Mustang