c#获取打印机列表

第一步:添加引用
using System.Printing;

第二步:代码
public static List<string> GetPrintList()
{
    List<string> lt = new List<string>();
    LocalPrintServer printServer = new LocalPrintServer();
    PrintQueueCollection printQueuesOnLocalServer = printServer.GetPrintQueues(new[] { EnumeratedPrintQueueTypes.Local });
    foreach (PrintQueue printer in printQueuesOnLocalServer)
        lt.Add(printer.Name);
    return lt;
}

 

 

转载自:https://www.cnblogs.com/edielei/p/4966366.html

posted @ 2018-07-20 18:02  AZRNG  阅读(412)  评论(0编辑  收藏  举报