1. 程式人生 > >C# 獲取印表機列表

C# 獲取印表機列表

        public 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;
        }