.Net frame work allows you to enjoy rich set of printing functionalities. Lets’s learn how to list all printers in a system in C#
Using the PinterSetting class you can access a list of installed printers on your system and can be added to any control you want.
The Printer class belong to the System.Drawing.Printing package, so you need to reference the class by including using System.Drawing.Printing;, at the start of the program module/form.
PrinterSettings setting = new PrinterSettings(); listBox1.Items.Clear(); foreach (string prntr in PrinterSettings.InstalledPrinters) { System.Console.WriteLine(prntr); listBox1.Items.Add(prntr); }
The above mentioned code will add all installed printer names to a list box.