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

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

foreach (var printer in printersName)
{
    Console.WriteLine(printer);
}
Imports IronPrint
Imports System
Imports System.Collections.Generic

' Retrieve printers' name
Dim printersName As List(Of String) = Printer.GetPrinterNames()

For Each printer In printersName
    Console.WriteLine(printer)
Next
NuGet Download
PM > Install-Package IronPrint
获取打印机名称

获取打印机名称

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

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

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

准备开始了吗?

Nuget Downloads 46,090版本:2026.9刚刚发布

Key in blue circle

立即获取免费的 30 天试用版密钥

Your trial license will be sent to your email address

无任何限制。100% 解锁。无需信用卡。

bullet_checked无需信用卡或创建账户无任何限制。100% 解锁。无需信用卡。
  • Logo Aetna
  • Logo NASA
  • Logo GE
  • Logo Porsche
  • Logo USDA
  • Logo Qatar
Join Millions of Engineers who’ve tried IronPDF
预约您的免费现场演示
Booking Badge

深受全球数百万工程师信赖

Iron Software 的客户徽标
获取您的无义务咨询
填写下面的表格或通过sales@ironsoftware.com
您的资料将始终保密。
深受全球数百万工程师信赖
Iron Software 的客户徽标
立即获取您的免费30 天试用密钥
无需信用卡或创建账户