List all available printers in C#.Net


.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.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.