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
  • 25

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
  • 35,368
  • 50
  • 149
  • 201
0

Use PrinterSettings class from the System.Drawing.Printing namespace

PrinterSettings.InstalledPrinters

should return you a list of Printers.

abhilash
  • 5,545
  • 3
  • 35
  • 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,795
  • 4
  • 28
  • 39