JDK-6263423 : Printer margins not always respected
  • Type: Bug
  • Component: client-libs
  • Sub-Component: 2d
  • Affected Version: 5.0
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_2000
  • CPU: x86
  • Submitted: 2005-04-29
  • Updated: 2011-02-16
  • Resolved: 2007-06-12
Related Reports
Duplicate :  
Description
FULL PRODUCT VERSION :
java version "1.5.0_01"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_01-b08)
Java HotSpot(TM) Client VM (build 1.5.0_01-b08, mixed mode, sharing)

and

java version "1.5.0_02"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_02-b09)
Java HotSpot(TM) Client VM (build 1.5.0_02-b09, mixed mode, sharing)

ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows 2000 [Version 5.00.2195]

A DESCRIPTION OF THE PROBLEM :
While it appears to work for many printers, PrinterJob().pageDialog() does not always correctly set the margins.  The margins are altered, but do not always resemble those entered.

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1) Add a "HP DesignJet 750C (E/A0) Color" printer.
2) Create a simple java application that allow editing a PrinterJob
3) Open the page dialog
4) Select the new HP DesignJet printer
5) Enter margins of 1, 1, 1, 1
6) Select OK
7) Open the PrinterJob's page dialog again
8) Note that the margins are not those entered

Alternate:
1) Add a "HP DesignJet 750C (E/A0) Color" printer.
2) Create a simple java application that allow editing a PrinterJob
3) Open the page dialog
4) Select the new HP DesignJet printer
5) Select an E size sheet (page size)
6) Select OK
7) Open the PrinterJob's page dialog again
8) Note that the right and bottom margins are not as they were

Results of the tests on a new XP SP 2 install.  The first test 
does not break in exactly the same way -- it resets margins to something 
that may simply be the minimum for that particular printer (left: 4.32, 
right: 3.89, top: 4.57, bottom: 4.66).  They don't seem quite even, and 
certainly aren't the (1,1,1,1) values that were entered, but this may be 
a separate issue.

However, the alternate test (provided with original report -- see below) 
does still break.  At step 7/8 of the alternate procedure, the margins I 
see are (left: 25.4, right: 658.62, top: 25.4, bottom: 825.92).

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The margins should always be as entered by the user (as it was in 1.4.2).
ACTUAL -
Margins are corrupted in various ways, depending on printer, page sizes, and entered values.

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
import java.awt.print.PageFormat;
import java.awt.print.PrinterJob;

public class BadPrinterMargins {
	public static void main(String[] args) {
		PrinterJob pj = PrinterJob.getPrinterJob();
		PageFormat pf = new PageFormat();
		pf = pj.pageDialog(pf);
		pj.pageDialog(pf);
	}
}
---------- END SOURCE ----------
###@###.### 2005-04-29 09:35:18 GMT

Comments
EVALUATION This is the same problem as described in 6359238. The test case displays the windows native page dialog and changes the printer to a large format printer and this results in incorrect imageable area/marings Normally I would close the later bug as a dup, but in this case since I was already looking at 6359238, I will close this one as a dup.
12-06-2007