Name: rmT116609 Date: 05/08/2003
FULL PRODUCT VERSION :
java version "1.4.2-beta"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2-beta-b19)
Java HotSpot(TM) Client VM (build 1.4.2-beta-b19, mixed mode)
FULL OS VERSION :
Microsoft Windows 2000 [Version 5.00.2195]
EXTRA RELEVANT SYSTEM CONFIGURATION :
HP DesignJet printer driver 4.63
A DESCRIPTION OF THE PROBLEM :
When the print dialog for a PrintJob is show, and a large media type has been selected, the returned PageAttributes contains the wrong media type iso-a10. The problem only happens when selecting a large media type, not a smaller one.
Selecting media types A,B,C,D,E and A4,A3 works; selecting F, A2,A1 or A0 returns media type A10 (maybe an overflow somewhere causes a negative page size, which is closest to the (possibly?) smallest media type A10?).
We have this problem on combination of any JRE 1.4.x version, with any Windows NT or 2000 computer (XP not tested yet) and any HP DesignJet printer (we could find, like 450C, 500, 750C and 750C+).
I also tried to reset the page-size to ISO_A4 and continue working with the PrintJob object, but under Windows NT, I get a Blue-Screen-Of-Death (!) every time, and under Windows 2000, the printer produces an empty page.
The only way to get the print to work is by not showing the print dialog :
jobAttributes.setDialog(JobAttributes.DialogType.NONE)
When the print dialog is not shown, the PrintJob performs without problems. The problem is that we cannot detect from Java if we have a DesignJet printer. So we put two 'Print' buttons in our application, one with print dialog and another without the print dialog. But some of our (100+) users tend to forget to use the second print button when printing to a DesignJet printer.
I hope you can find a DesignJet printer to reproduce this problem.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Create a PrintJob, and choose media type A2 or F
2. Print the selected Media Type of the PageAttributes
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Expected : the user selected media type (like iso-a2)
ACTUAL -
Actual : media type iso-a10
ERROR MESSAGES/STACK TRACES THAT OCCUR :
No exceptions or error messages occur
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.awt.*;
import javax.swing.*;
public class PrinterTest
{
static public void main(String[] args)
{
try
{
System.out.println("start");
JFrame frame = new JFrame("test");
JobAttributes jobAttributes = new JobAttributes();
PageAttributes pageAttributes = new PageAttributes();
pageAttributes.setMedia(PageAttributes.MediaType.ISO_A4);
System.out.println("before : "+pageAttributes.getMedia());
PrintJob printJob = Toolkit.getDefaultToolkit().getPrintJob(frame,"title",jobAttributes,pageAttributes);
printJob.end();
System.out.println("after : "+pageAttributes.getMedia());
System.exit(0);
}
catch (Exception e)
{
e.printStackTrace();
System.out.println("error");
System.exit(1);
}
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Not showing the print dialog :
jobAttributes.setDialog(JobAttributes.DialogType.NONE)
(Review ID: 185250)
======================================================================