WPF list available printers and trays

旧街凉风 提交于 2019-12-02 14:01:20

问题


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?


回答1:


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)




回答2:


    using System.Printing
    ......

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


来源:https://stackoverflow.com/questions/20519638/wpf-list-available-printers-and-trays

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!