LocalPrintServer LocalPrintServer LocalPrintServer LocalPrintServer Class

Definition

Represents the local print server (the computer on which your application is running) and enables management of its print queues.

public ref class LocalPrintServer sealed : System::Printing::PrintServer
public sealed class LocalPrintServer : System.Printing.PrintServer
type LocalPrintServer = class
    inherit PrintServer
Public NotInheritable Class LocalPrintServer
Inherits PrintServer
Inheritance

Examples

The following example shows how to create an instance of the LocalPrintServer class.

// -------------------- GetPrintXpsDocumentWriter() -------------------
/// <summary>
///   Returns an XpsDocumentWriter for the default print queue.</summary>
/// <returns>
///   An XpsDocumentWriter for the default print queue.</returns>
private XpsDocumentWriter GetPrintXpsDocumentWriter()
{
    // Create a local print server
    LocalPrintServer ps = new LocalPrintServer();

    // Get the default print queue
    PrintQueue pq = ps.DefaultPrintQueue;

    // Get an XpsDocumentWriter for the default print queue
    XpsDocumentWriter xpsdw = PrintQueue.CreateXpsDocumentWriter(pq);
    return xpsdw;
}// end:GetPrintXpsDocumentWriter()
' -------------------- GetPrintXpsDocumentWriter() -------------------
''' <summary>
'''   Returns an XpsDocumentWriter for the default print queue.</summary>
''' <returns>
'''   An XpsDocumentWriter for the default print queue.</returns>
Private Function GetPrintXpsDocumentWriter() As XpsDocumentWriter
    ' Create a local print server
    Dim ps As New LocalPrintServer()

    ' Get the default print queue
    Dim pq As PrintQueue = ps.DefaultPrintQueue

    ' Get an XpsDocumentWriter for the default print queue
    Dim xpsdw As XpsDocumentWriter = PrintQueue.CreateXpsDocumentWriter(pq)
    Return xpsdw
End Function ' end:GetPrintXpsDocumentWriter()

Remarks

When your application writes a value to a property of the LocalPrintServer object, that change has no effect until the value is passed to the computer that is represented by the LocalPrintServer object. To ensure that the change in value takes effect, use the Commit method.

In addition, other applications may also change the print service properties of the computer. To ensure that the LocalPrintServer object used by your application has the latest actual values, use the Refresh method.

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

LocalPrintServer() LocalPrintServer() LocalPrintServer() LocalPrintServer()

Initializes a new instance of the LocalPrintServer class.

LocalPrintServer(LocalPrintServerIndexedProperty[]) LocalPrintServer(LocalPrintServerIndexedProperty[]) LocalPrintServer(LocalPrintServerIndexedProperty[]) LocalPrintServer(LocalPrintServerIndexedProperty[])

Initializes a new instance of the LocalPrintServer class that has the specified LocalPrintServerIndexedProperty array.

LocalPrintServer(LocalPrintServerIndexedProperty[], PrintSystemDesiredAccess) LocalPrintServer(LocalPrintServerIndexedProperty[], PrintSystemDesiredAccess) LocalPrintServer(LocalPrintServerIndexedProperty[], PrintSystemDesiredAccess) LocalPrintServer(LocalPrintServerIndexedProperty[], PrintSystemDesiredAccess)

Initializes a new instance of the LocalPrintServer class that has the specified LocalPrintServerIndexedProperty array and the specified PrintSystemDesiredAccess.

LocalPrintServer(PrintSystemDesiredAccess) LocalPrintServer(PrintSystemDesiredAccess) LocalPrintServer(PrintSystemDesiredAccess) LocalPrintServer(PrintSystemDesiredAccess)

Initializes a new instance of the LocalPrintServer class that has the specified PrintSystemDesiredAccess.

LocalPrintServer(String[]) LocalPrintServer(String[]) LocalPrintServer(String[]) LocalPrintServer(String[])

Initializes a new instance of the LocalPrintServer class that has the specified properties.

LocalPrintServer(String[], PrintSystemDesiredAccess) LocalPrintServer(String[], PrintSystemDesiredAccess) LocalPrintServer(String[], PrintSystemDesiredAccess) LocalPrintServer(String[], PrintSystemDesiredAccess)

Initializes a new instance of the LocalPrintServer class that has the specified properties and PrintSystemDesiredAccess.

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.

(Inherited from PrintServer)
DefaultPortThreadPriority DefaultPortThreadPriority DefaultPortThreadPriority DefaultPortThreadPriority

Do not use.

(Inherited from PrintServer)
DefaultPrintQueue DefaultPrintQueue DefaultPrintQueue DefaultPrintQueue

Gets or sets the default print queue.

DefaultSchedulerPriority DefaultSchedulerPriority DefaultSchedulerPriority DefaultSchedulerPriority

Do not use.

(Inherited from PrintServer)
DefaultSpoolDirectory DefaultSpoolDirectory DefaultSpoolDirectory DefaultSpoolDirectory

Gets or sets the path where the print server's spool files are located.

(Inherited from PrintServer)
EventLog EventLog EventLog EventLog

Gets or sets the type of events that the print server logs.

(Inherited from PrintServer)
IsDelayInitialized IsDelayInitialized IsDelayInitialized IsDelayInitialized

Gets or sets a value that indicates whether initialization of the PrintServer properties has been postponed.

(Inherited from PrintServer)
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.

(Inherited from PrintServer)
MinorVersion MinorVersion MinorVersion MinorVersion

Gets the minor version within the major version of the operating system.

(Inherited from PrintServer)
Name Name Name Name

Gets the name of the print server.

(Inherited from PrintServer)
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.

(Inherited from PrintServer)
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.

(Inherited from PrintServer)
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.

(Inherited from PrintServer)
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.

(Inherited from PrintServer)
SchedulerPriority SchedulerPriority SchedulerPriority SchedulerPriority

Gets or sets the thread priority for the process that routes print jobs from applications to print queues.

(Inherited from PrintServer)
SubSystemVersion SubSystemVersion SubSystemVersion SubSystemVersion

Gets the version of the print spooler system.

(Inherited from PrintServer)

Methods

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

Writes any changes that your application made to the properties of the LocalPrintServer to the actual print server that the object represents.

ConnectToPrintQueue(PrintQueue) ConnectToPrintQueue(PrintQueue) ConnectToPrintQueue(PrintQueue) ConnectToPrintQueue(PrintQueue)

Connects the local print server to the specified PrintQueue.

ConnectToPrintQueue(String) ConnectToPrintQueue(String) ConnectToPrintQueue(String) ConnectToPrintQueue(String)

Connects to the print queue that is specified by using the String.

DisconnectFromPrintQueue(PrintQueue) DisconnectFromPrintQueue(PrintQueue) DisconnectFromPrintQueue(PrintQueue) DisconnectFromPrintQueue(PrintQueue)

Disconnects the local print server from the specified PrintQueue.

DisconnectFromPrintQueue(String) DisconnectFromPrintQueue(String) DisconnectFromPrintQueue(String) DisconnectFromPrintQueue(String)

Disconnects from the print queue that is specified in the String.

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

Returns a reference to the default print queue of the LocalPrintServer.

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.

(Inherited from PrintServer)
GetPrintQueue(String, String[]) GetPrintQueue(String, String[]) GetPrintQueue(String, String[]) GetPrintQueue(String, String[])

Gets a specified print queue from the print server.

(Inherited from PrintServer)
GetPrintQueues() GetPrintQueues() GetPrintQueues() GetPrintQueues()

Gets the collection of print queues that the print server hosts.

(Inherited from PrintServer)
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.

(Inherited from PrintServer)
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.

(Inherited from PrintServer)
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.

(Inherited from PrintServer)
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.

(Inherited from PrintServer)
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.

(Inherited from PrintServer)
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.

(Inherited from PrintServer)
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.

(Inherited from PrintServer)
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.

(Inherited from PrintServer)
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.

(Inherited from PrintServer)
InternalDispose(Boolean) InternalDispose(Boolean) InternalDispose(Boolean) InternalDispose(Boolean)

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

(Inherited from PrintServer)
MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

Creates a shallow copy of the current Object.

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

Updates the properties of the LocalPrintServer object so that their values match the values 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