Last post Jul 01, 2008 07:10 PM by jgilmore
Jul 01, 2008 07:10 PM|jgilmore|LINK
I am trying to get the list of available list of status codes and states for the Dell Laserjet 1710. I want to know if the printer is out of paper, paper jam, etc.
Here is the situation: I have a web application that users review invoices. If the invoice looks correct, they send it to something we called the Bill Print Queue. We do not want to print right away as this is done at the end of each day. At the end
of each day one person from the department will log into the Bill Print Queue, review the invoices and print them by selecting the invoices that need to be printed. Yes, it seems like a two step process but our business rules require it to be done this way.
Currently, users submit the invoice for print via the web application but the Billing Print Queue program is a VB 6 application with Crystal Reports. We are looking to get out of that and into a more streamlined approach with better error handeling and
having the app be server based.
I am able to send images/documents to the printer from the server to any local and/or remote printer without print dialogs appearing on the client and it printing to the printer that I set via properties. However, to support better error handeling, I want
to get the current status of the printer.
I have read that WMI for printers can be unreliable depending on the make and model, if it supports WMI and if it does support WMI if it even returns the current status and state of the printer.
I was able to disconnect the usb cable from my test system, send jobs to the printer and get a printer status of Idle and a printer state of Pause, which makes sense:
Caption = Dell Laser Printer 1710
Default = True
PrinterState = Paused
PrinterStatus = Idle
However, if I reconnect the USB cable the PrinterState integer returned from WMI is 1024! I have no error code that relates to 1024 or if that just happens to be the max value and everything is ok. An exception is thrown from my app as 1024 is out of
my bounds of my array, which makes sense, I don't have a status or state for 1024.
Here is the code I am using to query WMI (I can't claim that I wrote this, this is borrowed code from the web): (more of me continuing at the end)
I know I can use SNMP to query the printer as well, but that opens up even more issues and what if we change manf? Isn't there some 3rd party app that can handle this or are there any other suggestions? Is there a status and state for 1024 for this printer?
Does changing printers later open up more of a mess? Are the status codes standard or not? I know, alot of questions! I have read in numerous places that printing can be a nightmare in .net.