currently I'm encountering a strange behavior while using the PrinterJob class.
I've got a little program printing some pages. Most of the time the printer does its job as it should. But sometimes it takes minutes printing a page which was printed before in seconds.
It's absolutely random and not reproducible.
Following, the gist of the used code.
Where the Printable is a simple class implementing Printable and printing some text using Graphics.
Expand|Select|Wrap|Line Numbers
- private void createPrinterJob(...) {
- try {
- Printable gp = new Printable( ... );
- PrinterJob pjob = PrinterJob.getPrinterJob();
- if (pjob.printDialog() == false) {
- return;
- }
- pjob.setPrintable(gp);
- pjob.print();
- } catch (PrinterException ex) {
- ex.printStackTrace();
- }
- }