使用GetPrinterNames方法來獲取連接到機器上的所有可用印表機。該方法將以字串資料類型返回印表機名稱列表。
這段程式碼片段提供了一種簡單有效的方法來列出連接到您電腦的所有印表機,這對於在大型應用程式中偵錯或管理印表機設定非常有用。
探索進階印表機設定指南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)
NextImports 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使用GetPrinterNames方法來獲取連接到機器上的所有可用印表機。該方法將以字串資料類型返回印表機名稱列表。
這段程式碼片段提供了一種簡單有效的方法來列出連接到您電腦的所有印表機,這對於在大型應用程式中偵錯或管理印表機設定非常有用。
探索進階印表機設定指南NuGet 下載次數 52,106|版本:2026.11剛剛發布