I have a report document created by Microsoft Reporting but instead of using its viewer to show the document and print it, I used Pr开发者_JAVA百科intDocument class to print it directly without showing user any windows.
It worked perfectly until I installed a thermal printer and disabled its Spooler. Now once in a while i receive a Win32Exception indicating "The Device is not ready". I suppose this is because of the Spooler which I have disabled but because of a problem with the printer, I cannot enable it.
So, am I right about the problem? If so, is there anyways to check the printer before sending the print command?
The PRINTER_INFO_2 structure returned by GetPrinter() should return the printer status. The Microsoft Knowledgebase Article "How to get the status of a printer and a print job" includes example code written in C.
精彩评论