FULL PRODUCT VERSION :
java version "1.5.0_15"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_15-b04)
Java HotSpot(TM) Client VM (build 1.5.0_15-b04, mixed mode, sharing)
java version "1.6.0_05"
Java(TM) SE Runtime Environment (build 1.6.0_05-b13)
Java HotSpot(TM) Client VM (build 10.0-b19, mixed mode, sharing)
java version "1.6.0_10-beta"
Java(TM) SE Runtime Environment (build 1.6.0_10-beta-b13)
Java HotSpot(TM) Client VM (build 11.0-b11, mixed mode, sharing)
java version "1.7.0-ea"
Java(TM) SE Runtime Environment (build 1.7.0-ea-b24)
Java HotSpot(TM) Client VM (build 12.0-b01, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows [Version 6.0.6001]
EXTRA RELEVANT SYSTEM CONFIGURATION :
HP LaserJet 1100
Epson Stylus DX5050
A DESCRIPTION OF THE PROBLEM :
When printing multiple copies of a document the setting "Collate" is ignored in the native Dialog. Printing order is always n times page 1, n times page 2, ...
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Run the source.
2. Select "Collate" in the print dialog.
3. Start printing
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The result should contain 4 pages. Each containing one number in the following order: 0, 1, 0, 1
ACTUAL -
The result contains 4 pages. Each containing one number in the following order: 0, 0, 1, 1
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.print.PageFormat;
import java.awt.print.Printable;
import java.awt.print.PrinterException;
import java.awt.print.PrinterJob;
public class PrintTest {
public static class TwoPages implements Printable {
public int print(Graphics graphics, PageFormat pageFormat, int pageIndex)
throws PrinterException {
// print only two pages
if (pageIndex > 1) {
return NO_SUCH_PAGE;
}
// Ensure that text is visible
float x = (float) (pageFormat.getImageableX() + pageFormat
.getImageableWidth() / 2);
float y = (float) (pageFormat.getImageableY() + pageFormat
.getImageableHeight() / 2);
// print text
Graphics2D g2d = (Graphics2D) graphics;
g2d.drawString("" + pageIndex, x, y);
return PAGE_EXISTS;
}
}
public static void main(String[] args) throws PrinterException {
PrinterJob job = PrinterJob.getPrinterJob();
PageFormat pf = job.defaultPage();
job.setCopies(2);
job.setPrintable(new TwoPages(), pf);
if (job.printDialog()) {
job.print();
}
}
}
---------- END SOURCE ----------