获取打印机名称
using IronPrint;
using System;
using System.Collections.Generic;

// Retrieve printers' name
List<string> printersName = Printer.GetPrinterNames();

foreach (var printer in printersName)
{
    Console.WriteLine(printer);
}
NuGet下载
PM > Install-Package IronPrint
获取打印机名称

获取打印机名称

使用GetPrinterNames方法检索连接到机器的所有可用打印机。该方法将以字符串数据类型返回打印机名称列表。

这段代码片段提供了一种简单有效的方法来列出连接到您计算机的所有打印机,这对于在大型应用程序中调试或管理打印机配置非常有用。

探索高级打印机设置指南
在GitHub上查看

准备开始了吗?

NuGet 下载量 52,106版本:2026.11刚刚发布