取得印表機名稱
使用GetPrinterNames方法來檢索連接到機器的所有可用印表機。該方法將返回以字串資料型別表示的印表機名稱列表。
此程式碼片段提供了一種簡單且有效的方式來列出連接到您的機器的所有印表機,這在大型應用程式中進行除錯或管理印表機配置時非常有用。
準備好開始了嗎?
Nuget 下載 44,051 | 版本: 2026.7 剛剛發布
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 Private printersName As List(Of String) = Printer.GetPrinterNames() For Each printer In printersName Console.WriteLine(printer) Next printer
Install-Package IronPrint
使用GetPrinterNames方法來檢索連接到機器的所有可用印表機。該方法將返回以字串資料型別表示的印表機名稱列表。
此程式碼片段提供了一種簡單且有效的方式來列出連接到您的機器的所有印表機,這在大型應用程式中進行除錯或管理印表機配置時非常有用。