PrintServer PrintServer PrintServer PrintServer Class

定义

在打印服务器(通常是一台计算机,但也可能是专用硬件打印服务器设备)上管理打印队列。Manages the print queues on a print server, which is usually a computer, but can be a dedicated hardware print server appliance.

public ref class PrintServer : System::Printing::PrintSystemObject
public class PrintServer : System.Printing.PrintSystemObject
type PrintServer = class
    inherit PrintSystemObject
Public Class PrintServer
Inherits PrintSystemObject
继承
派生

示例

下面的示例演示如何创建的PrintServer实例。The following example shows how to create an instance of 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对象表示的计算机之前, 该更改将不起作用。When your program writes a value to a property of PrintServer, that change has no effect until it is passed on to the computer that is represented by the PrintServer object. 若要提交更改, 请Commit使用对象的方法。To commit changes, use the Commit method for the object.

同样, 其他应用程序可能会更改计算机的实际打印服务属性。Similarly, other applications may change the actual print service properties of the computer. 若要确保程序的PrintServer对象具有最新值, 请Refresh使用对象的方法。To make sure that the PrintServer object for your program has the latest values, use the Refresh method for the object.

注意

System.Printing命名空间中的类不支持在 Windows 服务或 ASP.NET 应用程序或服务中使用。Classes within the System.Printing namespace are not supported for use within a Windows service or ASP.NET application or service. 尝试从这些应用程序类型之一中使用这些类可能会产生意外的问题, 例如降低服务性能和运行时异常。Attempting to use these classes from within one of these application types may produce unexpected problems, such as diminished service performance and run-time exceptions.

如果要从 Windows 窗体应用程序进行打印, 请参阅System.Drawing.Printing命名空间。If you want to print from a Windows Forms application, see the System.Drawing.Printing namespace.

构造函数

PrintServer() PrintServer() PrintServer() PrintServer()

初始化 PrintServer 类的新实例。Initializes a new instance of the PrintServer class.

PrintServer(PrintSystemDesiredAccess) PrintServer(PrintSystemDesiredAccess) PrintServer(PrintSystemDesiredAccess) PrintServer(PrintSystemDesiredAccess)

初始化表示本地打印服务器的 PrintServer 类的一个新实例,并为其分配指定的 PrintSystemDesiredAccessInitializes a new instance of the PrintServer class that represents the local print server and assigns it the specified PrintSystemDesiredAccess.

PrintServer(String) PrintServer(String) PrintServer(String) PrintServer(String)

初始化具有指定路径的 PrintServer 类的一个新实例。Initializes a new instance of the PrintServer class that has the specified path.

PrintServer(String, PrintServerIndexedProperty[]) PrintServer(String, PrintServerIndexedProperty[]) PrintServer(String, PrintServerIndexedProperty[]) PrintServer(String, PrintServerIndexedProperty[])

初始化 PrintServer 类的一个新实例,方法是使用指定的 PrintServerIndexedProperty 数组来确定将初始化的属性。Initializes a new instance of the PrintServer class by using the specified PrintServerIndexedProperty array to determine which properties will be initialized.

PrintServer(String, PrintServerIndexedProperty[], PrintSystemDesiredAccess) PrintServer(String, PrintServerIndexedProperty[], PrintSystemDesiredAccess) PrintServer(String, PrintServerIndexedProperty[], PrintSystemDesiredAccess) PrintServer(String, PrintServerIndexedProperty[], PrintSystemDesiredAccess)

初始化 PrintServer 类的一个新实例,并提供指定路径、PrintServerIndexedProperty 数组和所需访问。Initializes a new instance of the PrintServer class and provides the specified path, the PrintServerIndexedProperty array, and the needed access.

PrintServer(String, PrintSystemDesiredAccess) PrintServer(String, PrintSystemDesiredAccess) PrintServer(String, PrintSystemDesiredAccess) PrintServer(String, PrintSystemDesiredAccess)

初始化具有指定路径和所需访问的 PrintServer 类的一个新实例。Initializes a new instance of the PrintServer class that has the specified path and the needed access.

PrintServer(String, String[]) PrintServer(String, String[]) PrintServer(String, String[]) PrintServer(String, String[])

初始化具有指定路径和属性筛选器的 PrintServer 类的一个新实例。Initializes a new instance of the PrintServer class that has the specified path and properties filter.

PrintServer(String, String[], PrintSystemDesiredAccess) PrintServer(String, String[], PrintSystemDesiredAccess) PrintServer(String, String[], PrintSystemDesiredAccess) PrintServer(String, String[], PrintSystemDesiredAccess)

初始化具有指定路径、属性筛选器和所需访问的 PrintServer 类的一个新实例。Initializes a new instance of the PrintServer class that has the specified path, properties filter, and the needed access.

属性

BeepEnabled BeepEnabled BeepEnabled BeepEnabled

获取或设置一个值,该值指示打印服务器是否在打印机出现错误情况时发出提示音。Gets or sets a value that indicates whether the print server beeps in response to an error condition in the printer.

DefaultPortThreadPriority DefaultPortThreadPriority DefaultPortThreadPriority DefaultPortThreadPriority

请勿使用。Do not use.

DefaultSchedulerPriority DefaultSchedulerPriority DefaultSchedulerPriority DefaultSchedulerPriority

请勿使用。Do not use.

DefaultSpoolDirectory DefaultSpoolDirectory DefaultSpoolDirectory DefaultSpoolDirectory

获取或设置打印服务器后台文件的路径。Gets or sets the path where the print server's spool files are located.

EventLog EventLog EventLog EventLog

获取或设置打印服务器记录的事件的类型。Gets or sets the type of events that the print server logs.

IsDelayInitialized IsDelayInitialized IsDelayInitialized IsDelayInitialized

获取或设置一个值,该值指示 PrintServer 属性的初始化是否已推迟。Gets or sets a value that indicates whether initialization of the PrintServer properties has been postponed.

IsDisposed IsDisposed IsDisposed IsDisposed

获取或设置一个值,该值指示该对象是否已被释放。Gets or sets a value that indicates whether the object has been disposed.

(Inherited from PrintSystemObject)
MajorVersion MajorVersion MajorVersion MajorVersion

获取操作系统的主版本。Gets the major version of the operating system.

MinorVersion MinorVersion MinorVersion MinorVersion

在操作系统的主版本中获取次版本。Gets the minor version within the major version of the operating system.

Name Name Name Name

获取打印服务器的名称。Gets the name of the print server.

NetPopup NetPopup NetPopup NetPopup

获取或设置一个值,该值指示打印作业已完成的通知是发送到打印服务器,还是发送到客户端计算机。Gets or sets a value that indicates whether notifications that a print job has finished are sent to either the print server or the client computer.

Parent Parent Parent Parent

获取对象的父级。Gets the parent of the object.

(Inherited from PrintSystemObject)
PortThreadPriority PortThreadPriority PortThreadPriority PortThreadPriority

获取或设置管理打印机端口 I/O 的进程的线程优先级别。Gets or sets the thread priority for the process that manages I/O through the printer ports.

PropertiesCollection PropertiesCollection PropertiesCollection PropertiesCollection

获取特性和值对的集合。Gets a collection of attribute and value pairs.

(Inherited from PrintSystemObject)
RestartJobOnPoolEnabled RestartJobOnPoolEnabled RestartJobOnPoolEnabled RestartJobOnPoolEnabled

获取或设置一个值,该值指示用户在已启用打印机池的情况下发生错误后是否可重新启动作业。Gets or sets a value that indicates whether users can restart jobs after an error occurs if printer pooling is enabled.

RestartJobOnPoolTimeout RestartJobOnPoolTimeout RestartJobOnPoolTimeout RestartJobOnPoolTimeout

获取或设置一个值,该值指示在启用打印机池的情况下发生错误时重新启动作业之前的等待时间。Gets or sets a value that indicates the wait time before a job can be restarted, if an error occurs when printer pooling is also enabled.

SchedulerPriority SchedulerPriority SchedulerPriority SchedulerPriority

获取或设置将打印作业从应用程序路由到打印队列的进程的线程优先级别。Gets or sets the thread priority for the process that routes print jobs from applications to print queues.

SubSystemVersion SubSystemVersion SubSystemVersion SubSystemVersion

获取打印后台处理程序系统的版本。Gets the version of the print spooler system.

方法

Commit() Commit() Commit() Commit()

提交程序对打印服务器对象属性的所有更改,方法是将这些更改写入此对象表示的打印服务器。Commits any changes that your program made to the properties of the print server object by writing them to the print server that the object represents.

DeletePrintQueue(PrintQueue) DeletePrintQueue(PrintQueue) DeletePrintQueue(PrintQueue) DeletePrintQueue(PrintQueue)

从打印服务器中移除指定的 PrintQueueRemoves the specified PrintQueue from the print server.

DeletePrintQueue(String) DeletePrintQueue(String) DeletePrintQueue(String) DeletePrintQueue(String)

从打印服务器中移除具有指定名称的打印队列。Removes the print queue with the specified name from the print server.

Dispose() Dispose() Dispose() Dispose()

释放由 PrintSystemObject 使用的所有资源。Releases all resources used by the PrintSystemObject.

(Inherited from PrintSystemObject)
Dispose(Boolean) Dispose(Boolean) Dispose(Boolean) Dispose(Boolean)

释放由 PrintSystemObject 占用的非托管资源,还可以另外再释放托管资源。Releases the unmanaged resources used by the PrintSystemObject and optionally releases the managed resources.

(Inherited from PrintSystemObject)
Equals(Object) Equals(Object) Equals(Object) Equals(Object)

确定指定的对象是否等于当前对象。Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetHashCode() GetHashCode() GetHashCode() GetHashCode()

作为默认哈希函数。Serves as the default hash function.

(Inherited from Object)
GetPrintQueue(String) GetPrintQueue(String) GetPrintQueue(String) GetPrintQueue(String)

从打印服务器中获取命名打印队列的引用。Obtains a reference to the named print queue from the print server.

GetPrintQueue(String, String[]) GetPrintQueue(String, String[]) GetPrintQueue(String, String[]) GetPrintQueue(String, String[])

从打印服务器中获取指定的打印队列。Gets a specified print queue from the print server.

GetPrintQueues() GetPrintQueues() GetPrintQueues() GetPrintQueues()

获取打印服务器承载的打印队列的集合。Gets the collection of print queues that the print server hosts.

GetPrintQueues(EnumeratedPrintQueueTypes[]) GetPrintQueues(EnumeratedPrintQueueTypes[]) GetPrintQueues(EnumeratedPrintQueueTypes[]) GetPrintQueues(EnumeratedPrintQueueTypes[])

获取在 EnumeratedPrintQueueTypes 中命名并由打印服务器承载的指定类型的打印队列集合。Gets the collection of print queues of the specified types that are named in EnumeratedPrintQueueTypes and hosted by the print server.

GetPrintQueues(PrintQueueIndexedProperty[]) GetPrintQueues(PrintQueueIndexedProperty[]) GetPrintQueues(PrintQueueIndexedProperty[]) GetPrintQueues(PrintQueueIndexedProperty[])

获取由打印服务器承载的且仅在 PrintQueueIndexedProperty 数组中指定属性中初始化的打印队列的集合。Gets a collection of print queues that are hosted by the print server and initialized only in the properties that are specified in the PrintQueueIndexedProperty array.

GetPrintQueues(PrintQueueIndexedProperty[], EnumeratedPrintQueueTypes[]) GetPrintQueues(PrintQueueIndexedProperty[], EnumeratedPrintQueueTypes[]) GetPrintQueues(PrintQueueIndexedProperty[], EnumeratedPrintQueueTypes[]) GetPrintQueues(PrintQueueIndexedProperty[], EnumeratedPrintQueueTypes[])

获取指定类型的打印队列的集合。Gets a collection of print queues of the specified types. 这些打印队列仅在由 PrintQueueIndexedProperty 数组指定的属性中进行初始化。These print queues are only initialized in the properties that are specified in the PrintQueueIndexedProperty array.

GetPrintQueues(String[]) GetPrintQueues(String[]) GetPrintQueues(String[]) GetPrintQueues(String[])

获取由打印服务器承载的以及仅在指定属性中初始化的打印队列的集合。Gets a collection of print queues that are hosted by the print server and that are initialized only in the specified properties.

GetPrintQueues(String[], EnumeratedPrintQueueTypes[]) GetPrintQueues(String[], EnumeratedPrintQueueTypes[]) GetPrintQueues(String[], EnumeratedPrintQueueTypes[]) GetPrintQueues(String[], EnumeratedPrintQueueTypes[])

获取打印队列的集合,这些打印队列具有指定的 EnumeratedPrintQueueTypes 并仅在指定的属性中进行初始化。Gets the collection of print queues, which are of the specified EnumeratedPrintQueueTypes and are initialized only in the specified properties.

GetType() GetType() GetType() GetType()

获取当前实例的 TypeGets the Type of the current instance.

(Inherited from Object)
Initialize() Initialize() Initialize() Initialize()

初始化 PrintSystemObject 的属性。Initializes the properties of the PrintSystemObject.

(Inherited from PrintSystemObject)
InstallPrintQueue(String, String, String[], String, PrintPropertyDictionary) InstallPrintQueue(String, String, String[], String, PrintPropertyDictionary) InstallPrintQueue(String, String, String[], String, PrintPropertyDictionary) InstallPrintQueue(String, String, String[], String, PrintPropertyDictionary)

在打印服务器上安装打印队列及关联的打印机驱动程序。Installs a print queue, and associated printer driver, on the print server.

InstallPrintQueue(String, String, String[], String, PrintQueueAttributes) InstallPrintQueue(String, String, String[], String, PrintQueueAttributes) InstallPrintQueue(String, String, String[], String, PrintQueueAttributes) InstallPrintQueue(String, String, String[], String, PrintQueueAttributes)

在打印服务器上安装打印队列及关联的打印机驱动程序。Installs a print queue, and associated printer driver, on the print server.

InstallPrintQueue(String, String, String[], String, PrintQueueAttributes, PrintQueueStringProperty, Int32, Int32) InstallPrintQueue(String, String, String[], String, PrintQueueAttributes, PrintQueueStringProperty, Int32, Int32) InstallPrintQueue(String, String, String[], String, PrintQueueAttributes, PrintQueueStringProperty, Int32, Int32) InstallPrintQueue(String, String, String[], String, PrintQueueAttributes, PrintQueueStringProperty, Int32, Int32)

在打印服务器上安装按优先级别排列的打印队列及关联的打印机驱动程序。Installs a prioritized print queue, and associated printer driver, on the print server.

InstallPrintQueue(String, String, String[], String, PrintQueueAttributes, String, String, String, String, Int32, Int32) InstallPrintQueue(String, String, String[], String, PrintQueueAttributes, String, String, String, String, Int32, Int32) InstallPrintQueue(String, String, String[], String, PrintQueueAttributes, String, String, String, String, Int32, Int32) InstallPrintQueue(String, String, String[], String, PrintQueueAttributes, String, String, String, String, Int32, Int32)

在打印服务器上安装按优先级别排列的共享打印队列及关联的打印机驱动程序。Installs a shared, prioritized print queue, and associated printer driver, on the print server.

InternalDispose(Boolean) InternalDispose(Boolean) InternalDispose(Boolean) InternalDispose(Boolean)

释放由 PrintServer 占用的非托管资源并(可选)释放托管资源。Releases the unmanaged resources that are used by the PrintServer and optionally releases the managed resources.

MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

创建当前 Object 的浅表副本。Creates a shallow copy of the current Object.

(Inherited from Object)
Refresh() Refresh() Refresh() Refresh()

更新 PrintServer 对象的属性,以使各属性值与此对象表示的打印服务器的相应特性值一致。Updates the properties of the PrintServer object so that each property value matches the corresponding attribute value of the print server that the object represents.

ToString() ToString() ToString() ToString()

返回表示当前对象的字符串。Returns a string that represents the current object.

(Inherited from Object)

适用于

另请参阅