Selva
Selva

Reputation: 1360

WPF list available printers and trays

I'm writing WPF application which needs to display list of available Printers and corresponding trays.

I can able to get list of available printers by loop through the following line

PrinterSettings.InstalledPrinters

and now stuck up with getting corresponding printer trays. could anybody give sample code?

Upvotes: 2

Views: 2709

Answers (2)

menxin
menxin

Reputation: 2244

    using System.Printing
    ......

    var printers = new LocalPrintServer().GetPrintQueues().Select(v => v.Name);

Upvotes: 4

gleng
gleng

Reputation: 6304

You are looking for PaperSources property - Gets the paper source trays that are available on the printer. (MSDN: http://msdn.microsoft.com/en-us/library/system.drawing.printing.printersettings%28v=vs.110%29.aspx)

Upvotes: 3

Related Questions