如何使用 c# 在 asp.net 中列出客户端打印机?
我的代码:这将列出连接到服务器的打印机。
ManagementScope scope = new ManagementScope(@"\root\cimv2");
scope.Connect();
ManagementObjectSearcher searcher = new ManagementObjectSearcher("SELECT * FROM Win32_Printer");
foreach (ManagementObject printer in searcher.Get())
{
string printerName = printer["Name"].ToString().ToLower();
Response.Write("chethann ");
Response.Write(printerName);
}