No more Death March

あるSEのチラシの裏 C# WPF

インストールされているプリンターの一覧を取得する。

using System;
using System.Printing;

namespace LocalPrintersName
{
    class Program
    {
        static void Main(string[] args)
        {

            foreach(var queue in new LocalPrintServer().GetPrintQueues())
            {
                Console.WriteLine(queue.FullName);
            }
            Console.ReadLine();
        }
    }
}

LocalPrintServerのインスタンスメソッドGetPrintQueuesを実行
実行した端末のPrintQueueクラスのコレクションが返る。

後はPrintQueueクラスのプロパティを出力