WHY Wishmove?

wishmove.com is the go to place for people planning to move

  • Address: 41 Carlton Avenue
    Feltham, London, TW14 0EE
  • Phone: 0800 246 5469
  • Email: support@wishmove.com

How to check if printer is ready using c#

software program code

An easy but quick way to check if your printer is ready to follow you command

Say we have a document and we need to print it directly from our program instead of asking for help from PrintDialog or some other built-in feature. Before we send command to the printer, to print, we do need to check that printer is ready for command execution and there is no problem with it. Other wise, printer may raise error for any reason like, out of paper or ink problems or any thing else. This will cause an exception to be raised which is going to make the customer think .$5^&*…. about us which is not desirable.

So, is there any way to check if the device is ready ? before we send the print command ?

Here are two of the several methods, we can use to do so


public bool CheckMyPrinter(string printerToCheck)
  ManagementObjectSearcher searcher = new  
  ManagementObjectSearcher("SELECT * FROM   Win32_Printer"); 
  bool IsReady = false;
  foreach (ManagementObject printer in searcher.Get())

if (printer["Name"].ToString().ToLower().Equals(printerToCheck)) {
if (printer["WorkOffline"].ToString().ToLower().Equals("false")) { IsReady = true; }
} return IsReady ; }

METHOD 2: Will throw Exception, but you can catch it and work accordingly

bool printerStatus = false; try { PrintDocument pd = new PrintDocument
{ PrinterSettings = new PrinterSettings { PrinterName = "Name" } }; printerStatus = pd.PrinterSettings.IsValid; } catch (System.Exception ex) { }