PrintServer PrintServer PrintServer PrintServer Class

Definition

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
Inheritance
Derived

Examples

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()

Remarks

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. To commit changes, use the Commit method for the object.

Similarly, other applications may change the actual print service properties of the computer. To make sure that the PrintServer object for your program has the latest values, use the Refresh method for the object.

Caution

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.

If you want to print from a Windows Forms application, see the System.Drawing.Printing namespace.

Constructors

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

Initializes a new instance of the PrintServer class.

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

Initializes 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)

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[])

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)

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)

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[])

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)

Initializes a new instance of the PrintServer class that has the specified path, properties filter, and the needed access.

Properties

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

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

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.

Methods

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)

Removes 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()

Releases all resources used by the PrintSystemObject.

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

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[])

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[])

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. 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[])

Gets the collection of print queues, which are of the specified EnumeratedPrintQueueTypes and are initialized only in the specified properties.

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

Gets the Type of the current instance.

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

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)

Releases the unmanaged resources that are used by the PrintServer and optionally releases the managed resources.

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

Creates a shallow copy of the current Object.

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

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)

Applies to

See also