PrintServer 類別
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
管理列印伺服器上的列印佇列,而列印伺服器通常是電腦,但也可以是專屬的硬體列印伺服器應用裝置。
public ref class PrintServer : System::Printing::PrintSystemObject
public class PrintServer : System.Printing.PrintSystemObject
type PrintServer = class
inherit PrintSystemObject
Public Class PrintServer
Inherits PrintSystemObject
- 繼承
- 衍生
範例
下列範例示範如何建立 的 PrintServer 實例。
// Create a PrintServer
// "theServer" must be a print server to which the user has full print access.
PrintServer myPrintServer = new PrintServer(@"\\theServer");
// List the print server's queues
PrintQueueCollection myPrintQueues = myPrintServer.GetPrintQueues();
String printQueueNames = "My Print Queues:\n\n";
foreach (PrintQueue pq in myPrintQueues)
{
printQueueNames += "\t" + pq.Name + "\n";
}
Console.WriteLine(printQueueNames);
Console.WriteLine("\nPress Return to continue.");
Console.ReadLine();
' Create a PrintServer
' "theServer" must be a print server to which the user has full print access.
Dim myPrintServer As New PrintServer("\\theServer")
' List the print server's queues
Dim myPrintQueues As PrintQueueCollection = myPrintServer.GetPrintQueues()
Dim printQueueNames As String = "My Print Queues:" & vbLf & vbLf
For Each pq As PrintQueue In myPrintQueues
printQueueNames &= vbTab & pq.Name & vbLf
Next pq
Console.WriteLine(printQueueNames)
Console.WriteLine(vbLf & "Press Return to continue.")
Console.ReadLine()
備註
當您的程式將值寫入 的 PrintServer 屬性時,該變更在傳遞給 物件所 PrintServer 代表的電腦之前沒有任何作用。 若要認可變更,請使用 Commit 物件的 方法。
同樣地,其他應用程式可能會變更電腦的實際列印服務屬性。 若要確定 PrintServer 程式的物件具有最新的值,請使用 Refresh 物件的 方法。
警告
不支援命名空間內的 System.Printing 類別用於 Windows 服務或 ASP.NET 應用程式或服務。 嘗試從其中一個應用程式類型內使用這些類別可能會產生非預期的問題,例如服務效能降低和執行時間例外狀況。
如果您想要從Windows Forms應用程式列印,請參閱 System.Drawing.Printing 命名空間。
建構函式
PrintServer() |
初始化 PrintServer 類別的新執行個體。 |
PrintServer(PrintSystemDesiredAccess) |
初始化表示本機列印伺服器並指派它為指定 PrintServer 之 PrintSystemDesiredAccess 類別的新執行個體。 |
PrintServer(String) |
初始化具有指定路徑之 PrintServer 類別的新執行個體。 |
PrintServer(String, PrintServerIndexedProperty[]) |
使用指定的 PrintServer 陣列決定要初始化的屬性,初始化 PrintServerIndexedProperty 類別的新執行個體。 |
PrintServer(String, PrintServerIndexedProperty[], PrintSystemDesiredAccess) |
初始化 PrintServer 類別的新執行個體並提供指定的路徑、PrintServerIndexedProperty 陣列和所需存取。 |
PrintServer(String, PrintSystemDesiredAccess) |
初始化具有指定路徑和所需存取之 PrintServer 類別的新執行個體。 |
PrintServer(String, String[]) |
初始化具有指定路徑和屬性篩選器之 PrintServer 類別的新執行個體。 |
PrintServer(String, String[], PrintSystemDesiredAccess) |
初始化具有指定路徑、屬性篩選器和所需存取之 PrintServer 類別的新執行個體。 |
屬性
BeepEnabled |
取得或設定值,指出列印伺服器是否在印表機出現錯誤狀況時發出嗶聲做為回應。 |
DefaultPortThreadPriority |
請勿使用。 |
DefaultSchedulerPriority |
請勿使用。 |
DefaultSpoolDirectory |
取得或設定路徑,這個路徑為列印伺服器緩衝處理檔案的所在位置。 |
EventLog |
取得或設定列印伺服器要記錄的事件型別。 |
IsDelayInitialized |
取得或設定值,指出是否延後 PrintServer 屬性的初始化。 |
IsDisposed |
取得或設定一個值,指出是否已經處置物件。 (繼承來源 PrintSystemObject) |
MajorVersion |
取得作業系統的主要版本。 |
MinorVersion |
取得作業系統之主要版本中的次要版本。 |
Name |
取得列印伺服器的名稱。 |
NetPopup |
取得或設定值,指出要將列印工作已完成之通知傳送給列印伺服器或用戶端電腦。 |
Parent |
取得物件的父物件。 (繼承來源 PrintSystemObject) |
PortThreadPriority |
取得或設定透過印表機通訊埠管理 I/O 之處理序的執行緒優先權。 |
PropertiesCollection |
取得屬性和值組的集合。 (繼承來源 PrintSystemObject) |
RestartJobOnPoolEnabled |
取得或設定值,指出使用者在啟動印表機集區下,是否能在發生錯誤後重新啟動工作。 |
RestartJobOnPoolTimeout |
取得或設定值,指出如果在啟動印表機集區時發生錯誤,重新啟動工作之前的等待時間。 |
SchedulerPriority |
取得或設定處理序的執行緒優先權,這個處理序會將列印工作從應用程式傳送到列印佇列。 |
SubSystemVersion |
取得列印多工緩衝處理程式系統的版本。 |
方法
適用於
另請參閱
意見反應
https://aka.ms/ContentUserFeedback。
即將登場:在 2024 年,我們將逐步淘汰 GitHub 問題作為內容的意見反應機制,並將它取代為新的意見反應系統。 如需詳細資訊,請參閱:提交並檢視相關的意見反應