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
