My application has a print screen button. Off late a few clients have sent in a few error reports. This is an example stack trace:
I have not been able to duplicate the problem myself but a client told me that this happens often (does'nt happen everytime they click the "Print Screen" button), and when it fails it causes the application to freeze and they have to terminate the app using the "Task Manager".
Here is the action my "Print Screen" button is bound to:
Here is my implementation of the PrintUtilities class, with the print methods:
Please use code tags. I've added them for you this time, and look how much easier it is to read your code.
The stack trace tells you a lot of where the problem is coming from:This tells me that the problem is in the PrinterResolution constructor that is called. This constructor takes a crossFeedResolution that it uses in calling the super constructor. Now the bad news. This PrinterResolution instance is created by one of Sun's internal classes, sun.awt.windows.WPrinterJob. I don't have the source of that.
The rest of the stack trace informs me that the issue is not caused by your code but by the Java API instead. When the print dialog is shown (sun.awt.windows.WPrintDialogPeer._show) this is setting the resolution but it can't determine it, thereby passing -1 to the PrinterResolution constructor. I can't tell you how to solve this though. Perhaps it simply is a matter of incorrect printer drivers, or something else outside the world of Java.
Thank You for your reply Rob. I will make sure I use the "code" tags next time. That was my first post
I heard today that there is more than one client with the same problem. I will ask one who had this problem yesterday to update their printer drivers and check if it fixes the problem. We usually tell the clients to update their Java when we have a problem like this but this client is on Java 1.6.0_17.