For Programmers: Free Programming Magazines  


Home > Archive > C# > February 2005 > Errorhandling/monitoring of printer









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Errorhandling/monitoring of printer
Marcus Malmgren

2005-02-24, 8:58 am

Hello!

I have a labelprinter (Zebra 105SL) which I want to monitor. I want
errors to be displayed in my C#-program, for example "power off" or
"printer out of paper".

I have tried using WMI's ManagementObject and PropertyData to do this.
According to MSDN there 25 values in PrinterState member in
win32_printers, but i only get 3 values (unknown, idle and printing).
I get the same result with PrinterStatus member. I am not exactly sure
how this work. Am I asking the printer, or am I asking the spooler?
The spooler in windows is sometimes very slow. If the printer is off
(power off), it takes about 1 minute before the error is shown in the
spooler. Can this timeout be set somewhere, or do i set it when
printing?

OpenPrinter, BeginPrint, StartDocPrinter, StartPagePrinter,
WritePrinter calls to win32api are used to print. Maybe the timeout in
the spooler can be set here?

I want the printer to be installed in Windows as a "Generic / Text
Only" printer, but I have also tried the Zebra 105SL driver with the
same result.

I have also written a c program that checks the status member of a
PRINTER_INFO (win32api) but it always return PRINTER_STATUS_OK.

Is there another way to detect errors when printing?

Thanks in advance!
Marcus Malmgren
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com