Check valid printer

Description :


Check whether the given printer is valid or not

Following code is used to achive our target

Name spaces

using System;
using System.Drawing.Printing;


Code Segment

class MainClass {
static void Main(string[] args) {
foreach (string MyprinterName in PrinterSettings.InstalledPrinters) {
Console.WriteLine("Printer: {0}", MyprinterName);

PrinterSettings Myprinter = new PrinterSettings();
Myprinter.PrinterName = MyprinterName;
Console.WriteLine(Myprinter.IsValid);
}
}
}


Code Explanation

1. parsing the InstalledPrinters in the PrinterSettings
2. check whether the valid printer


By
Nathan


Comments

No responses found. Be the first to comment...


  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name:
    Email: