|
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 :
The PrinterJob.pageDialog() takes a PageFormat as input and
returns a PageFormat. For some input values, even though
the user doesn't modify anything and just hits "OK", a
slightly different set of values is returned for the
imageableWidth and imageableHeight.
For example, starting with a PageFormat with .6" margins, if
the pageDialog() is called repeatedly with the same
PageFormat, the returned values of the imageable width and
height slowly increase and the values of the right and
bottom margins shown in the page dialog slowly decrease.
If the user doesn't change anything, the values in
the returned PageFormat should be identical to the input.
The JDK 1.4 cross-platform pageDialog has the same problem.
The standard Windows page setup dialog (e.g., WordPad) does
not exhibit the problem.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Build and run the program below
2. Hit "OK" multiple times
3. Watch the right and bottom margins in page dialog
decrease and printout of imageableWidth and imageableHeight
increase
EXPECTED VERSUS ACTUAL BEHAVIOR :
Expected printout:
525.6 705.6
525.6 705.6
525.6 705.6
525.6 705.6
etc.
Actual printout:
525.672 705.672
525.744 705.744
525.816 705.816
525.888 705.888
525.96 705.96
526.032 706.032
526.104 706.104
526.176 706.176
etc.
ERROR MESSAGES/STACK TRACES THAT OCCUR :
None
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 = new PageFormat();
Paper paper = new Paper();
double w = 612.0, h = 792.0; // US Letter
paper.setSize(w, h);
double m = 0.6 * 72; // .6" margins
paper.setImageableArea(m, m, w-2*m, h-2*m);
pf.setPaper(paper);
pf.setOrientation(PageFormat.PORTRAIT);
while (true) {
pf = pj.pageDialog(pf);
System.out.println(
pf.getImageableWidth() + " " +
pf.getImageableHeight());
}
}
}
---------- END SOURCE ----------
CUSTOMER WORKAROUND :
Use safe margins like .25, .5, etc.
(Review ID: 146027)
======================================================================
|