This week's book giveaway is in the HTML/CSS/JavaScript forum.
We're giving away four copies of Practical SVG and have Chris Coyier on-line!
See this thread for details.
Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

When printing, want to capture fact that printer off line

Kathy OConnell
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We have written an application that prints to a windows printer (LPT1). The code for the print method is below. It is written in java 1.3.
When running on a windows 2000 machine, if the printer is offline (eg not connected, run out of paper etc) then a message is displayed - eg "device is not connected". However, when running on a Windows 98 machine, no message comes back when the printer is offline. The machine just locks up and has to be turned off before anything can happen.
Is there a way I can capture the fact that the printer is not available and handle it in my program?
Any help would be greatly appreciated!
public void printDocket(ReceivalDocketEditAnchor anchor) throws ApplicationException {

try {
FileOutputStream fos = new FileOutputStream(ConfigurationManager.getValue(""));
PrintStream ps = new PrintStream(fos);

DocketObject docketData = new DocketObject(anchor);
} catch (Exception e)
System.out.println("Exception occurred during printing: " + e);
And will you succeed? Yes you will indeed! (98 and 3/4 % guaranteed) - Seuss. tiny ad:
the new thread boost feature brings a LOT of attention to your favorite threads
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!