|
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 :
Under JDK 1.4 if you use setPrintService(PrintService) to
select a printer programmatically, then use the native
setCopies(int) to specify a number of copies, and then use
the native print() to print, the specified number of copies
will be printed on the selected printer.
But if you call the native printDialog() after
setCopies(int), the number of copies shown in the dialog is
always 1 and saying OK results in only 1 copy printed.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Build and run program below
2. Note number of copies in print dialog that appears.
EXPECTED VERSUS ACTUAL BEHAVIOR :
Expected:
Print dialog says "Number of copies: 3"
Actual:
Print dialog says "Number of copies: 1"
ERROR MESSAGES/STACK TRACES THAT OCCUR :
None
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.awt.print.*;
import javax.print.*;
import javax.print.attribute.*;
import javax.print.attribute.standard.*;
public class Test {
static public void main(String args[]) {
DocFlavor flavor = DocFlavor.SERVICE_FORMATTED.PAGEABLE;
PrintRequestAttributeSet aSet
= new HashPrintRequestAttributeSet();
PrintService[] services
= PrintServiceLookup.lookupPrintServices(flavor, aSet);
PrinterJob pj = PrinterJob.getPrinterJob();
for (int i=0; i<services.length; i++)
System.out.println(services[i].getName());
try { pj.setPrintService(services[services.length-1]); }
catch (Exception e) { e.printStackTrace(); }
pj.setCopies(3);
pj.printDialog();
System.exit(0);
}
}
---------- END SOURCE ----------
CUSTOMER WORKAROUND :
Use the JDK 1.4 cross-platform print dialog and the "Copies"
PrintRequestAttribute.
(Review ID: 145945)
======================================================================
|