1

I want to write code in C# for loading printer name in window. But I don't have any ideas to write it.

Can anybody help me to solve this problem?

Thanks. Ung Sopolin

Sopolin
  • 576
  • 5
  • 15
  • 26

3 Answers3

0

Include a reference to the System.Drawing library and then:

var printers = PrinterSettings.InstalledPrinters.Cast<string>();

foreach (var printer in printers)
{
    Console.WriteLine(printer);
}

I think you might be interested in this post.

Community
  • 1
  • 1
Kredns
  • 36,461
  • 52
  • 152
  • 203
0

Use PrinterSettings class from the System.Drawing.Printing namespace

PrinterSettings.InstalledPrinters

should return you a list of Printers.

abhilash
  • 5,605
  • 3
  • 36
  • 59
0

PrinterSettings prSetting = new PrinterSettings();

Then prSetting.PrinterName will get you the name of the default printer name. You can use the same class for other Printer information.

Sesh
  • 5,993
  • 4
  • 30
  • 39