• Post Reply Bookmark Topic Watch Topic
  • New Topic

When printing, want to capture fact that printer off line  RSS feed

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("printer.windows.portname"));
PrintStream ps = new PrintStream(fos);

DocketObject docketData = new DocketObject(anchor);
} catch (Exception e)
System.out.println("Exception occurred during printing: " + e);
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!