Check for printer connection

onggie80

Member
Joined
Jan 26, 2004
Messages
8
Hi,

I need help in trying to check whether a printer is connected to the PC before sending my print job.

Currently, when my C# application sends a print job, the windows print spooler will just accept it regardless of whether the printer is actually connected to the PC or not. (Pls note: the printer is a parallel port printer)

Ive tried using WMI (Win32_Printer, Win32_PrintJob) to get the status, however they dont reflect the "real" status of the printer or the print job.

I am aware that there is Win API functions to send the print data directly to the printer, however, in my case, Im using a Crysal Report Print Function which combines my .rpt, .xml and .xsd files before sending the print job to the printer.

Thanks for all help!
 
Its a static method on the Printer object, part of the framework. I use it to verify that a string ("\\server\printer name") is a valid printer name before I pass it onto some 3rd party software. I get the strings from a database table and you cant ever trust your users to cut and paste things right :)

I know it works to locate a printer, but I dont think it will give you any kind of status. I also dont know of any way to determine if the printer is locally connected or not. I would guess you could, just never had the need.

-nerseus
 
Back
Top