แก้ไข

แชร์ผ่าน


PrintQueue Class

Definition

Manages printers and print jobs.

public ref class PrintQueue : System::Printing::PrintSystemObject
public class PrintQueue : System.Printing.PrintSystemObject
type PrintQueue = class
    inherit PrintSystemObject
Public Class PrintQueue
Inherits PrintSystemObject
Inheritance

Remarks

Some properties of the PrintQueue object represent characteristics of the print queue utility that runs on the computer, but others represent features or states of the printer itself. For example, NumberOfJobs is a characteristic of the print queue, but Location is a property of the printer. Many of the properties of the printer, such as whether it needs user attention, need to be passed, by means of the Refresh method, from the printer itself to the PrintQueue object. This should be done before the corresponding property (NeedUserIntervention) is read by your program. Similarly, when your program changes the values of one or more properties of a PrintQueue object, the change must be written to the actual print queue utility on the computer. Do this with the Commit 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

PrintQueue(PrintServer, String, Int32, PrintSystemDesiredAccess)

Initializes a new instance of PrintQueue class using the specified PrintServer, queue name, print schema version, and desired access.

PrintQueue(PrintServer, String, Int32)

Initializes a new instance of PrintQueue class using the specified PrintServer, queue name, and print schema version.

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

Initializes a new instance of PrintQueue class with the specified PrintServer, queue name, array of PrintQueueIndexedProperty values to initialize, and desired access.

PrintQueue(PrintServer, String, PrintQueueIndexedProperty[])

Initializes a new instance of PrintQueue class using the specified PrintServer, queue name, and array of PrintQueueIndexedProperty values to initialize.

PrintQueue(PrintServer, String, PrintSystemDesiredAccess)

Initializes a new instance of PrintQueue class using the specified PrintServer, queue name, and desired access.

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

Initializes a new instance of PrintQueue class using the specified PrintServer, queue name, property filter, and desired access.

PrintQueue(PrintServer, String, String[])

Initializes a new instance of PrintQueue class using the specified PrintServer, queue name, and array of property names to initialize.

PrintQueue(PrintServer, String)

Initializes a new instance of PrintQueue class using the specified PrintServer and queue name.

Properties

AveragePagesPerMinute

Gets the speed of the printer measured in pages per minute.

ClientPrintSchemaVersion

Gets the version of the Print Schema.

Comment

Gets or sets a comment about the printer.

CurrentJobSettings

Gets an object that contains the configuration settings for the current print job.

DefaultPrintTicket

Gets or sets the default printer options associated with this PrintQueue.

DefaultPriority

Gets or sets the default priority that is given to each new print job added to the queue.

Description

Gets a description of the print queue.

FullName

Gets the complete name of the queue.

HasPaperProblem

Gets a value that indicates if the printer is having an unspecified paper problem.

HasToner

Gets a value that indicates if the printer has toner.

HostingPrintServer

Gets or sets (protected) the print server that controls the print queue.

InPartialTrust

Gets or sets a value that indicates whether the queue is operating in a partially trusted mode, a higher level of trust.

IsBidiEnabled

Gets a value that indicates whether bidirectional communication with the printer is enabled.

IsBusy

Gets a value that indicates whether the printing device is busy.

IsDevQueryEnabled

Gets a value that indicates whether the queue holds documents when document and printer configurations do not match.

IsDirect

Gets a value that indicates whether the queue prints directly to the printer or spools documents first and then prints them.

IsDisposed

Gets or sets a value that indicates whether the object has been disposed.

(Inherited from PrintSystemObject)
IsDoorOpened

Gets a value that indicates whether a door is open on the printer.

IsHidden

Gets a value that indicates whether the print queue is hidden in your application's user interface.

IsInError

Gets a value that indicates whether the printer or device is in an error condition.

IsInitializing

Gets a value that indicates whether the printer is initializing itself.

IsIOActive

Gets a value that indicates whether the printer is receiving or sending data or signals.

IsManualFeedRequired

Gets a value that indicates whether the printer needs to be manually fed paper for the current print job.

IsNotAvailable

Gets a value that indicates whether the printer is available.

IsOffline

Gets a value that indicates whether the printer is offline.

IsOutOfMemory

Gets a value that indicates whether the printer is out of memory.

IsOutOfPaper

Gets a value that indicates whether the printer needs to be reloaded with paper of the size required for the current job.

IsOutputBinFull

Gets a value that indicates whether the output area of the printer is in danger of overflowing.

IsPaperJammed

Gets a value that indicates whether the current sheet of paper is stuck in the printer.

IsPaused

Gets a value that indicates whether the print queue has been paused.

IsPendingDeletion

Gets a value that indicates whether the printer is in the process of deleting a print job.

IsPowerSaveOn

Gets a value that indicates whether the printer is in power save mode.

IsPrinting

Gets a value that indicates whether a job is printing.

IsProcessing

Gets a value that indicates whether the printer is processing a print job.

IsPublished

Gets a value that indicates whether the printer is visible to other network users.

IsQueued

Gets a value that indicates whether the printer can support a queue with more than one print job in it at a time.

IsRawOnlyEnabled

Gets a value that indicates whether the print queue can use EMF (Enhanced Meta File) that enables faster data flow from a printing application to the Windows spooler.

IsServerUnknown

Gets a value that indicates whether the printer is in an error state.

IsShared

Gets a value that indicates whether the printer is available for use by other computers on the network.

IsTonerLow

Gets a value that indicates whether the printer is running short of toner.

IsWaiting

Gets a value that indicates whether the queue is waiting for a job to be added.

IsWarmingUp

Gets a value that indicates whether the printer is warming up.

IsXpsDevice

Gets a value that indicates whether the printer's driver is built on the XPSDrv model so it uses XML Paper Specification (XPS) as its page description language.

KeepPrintedJobs

Gets a value that indicates whether the queue is saving the printer language file instead of deleting it following printing.

Location

Gets or sets the printer's physical location.

MaxPrintSchemaVersion

Gets the most recent possible version number of the Print Schema that the queue can use.

Name

Gets or sets the print queue's name.

NeedUserIntervention

Gets a value that indicates whether the printer needs the attention of a human being.

NumberOfJobs

Gets the total number of jobs lined up in the print queue.

PagePunt

Gets a value that indicates whether the printer is unable to print the current page.

Parent

Gets the parent of the object.

(Inherited from PrintSystemObject)
PrintingIsCancelled

Gets or sets a value that indicates whether the current print job is being cancelled.

Priority

Gets or sets the priority of the print queue relative to other print queues that are hosted by the same print server and that use the same physical printer.

PropertiesCollection

Gets a collection of attribute and value pairs.

(Inherited from PrintSystemObject)
QueueAttributes

Gets the properties of the print queue.

QueueDriver

Gets or sets the printer driver for the queue.

QueuePort

Gets or sets the port that the queue uses.

QueuePrintProcessor

Gets or sets the print processor that the queue uses.

QueueStatus

Gets a value that represents the status of the printer. These include "warming up," "initializing," "printing," and others.

ScheduleCompletedJobsFirst

Gets a value that indicates whether the printer prints jobs that have completed the spooling process before jobs that have not fully spooled even if the latter entered the queue first or have a higher priority.

SeparatorFile

Gets or sets the path and file name of a file that is inserted at the beginning of each print job.

ShareName

Gets or sets a name for the printer that is seen by users on the network when it is shared.

StartTimeOfDay

Gets or sets the earliest time of day, expressed as the number of minutes after midnight Coordinated Universal Time (UTC) (also called Greenwich Mean Time [GMT]), that the printer will print a job.

UntilTimeOfDay

Gets or sets the latest time, expressed as the number of minutes after midnight Coordinated Universal Time (UTC) (also called Greenwich Mean Time [GMT]), that the printer will print a job.

UserPrintTicket

Gets or sets the current user's default PrintTicket object, which contains detailed information about the print job.

Methods

AddJob()

Inserts a new (generically named) print job, whose content is a Byte array, into the queue.

AddJob(String, PrintTicket)

Inserts a new print job for an XML Paper Specification (XPS) Document into the queue, and gives it the specified name and settings.

AddJob(String, String, Boolean, PrintTicket)

Inserts a new print job for an XML Paper Specification (XPS) Document into the queue, gives it the specified name and settings, and specifies whether or not it should be validated.

AddJob(String, String, Boolean)

Inserts a new print job for an XML Paper Specification (XPS) Document into the queue, gives it the specified name, and specifies whether or not it should be validated.

AddJob(String)

Inserts a new print job, whose content is a Byte array, into the queue.

Commit()

Writes the current properties of the PrintQueue object to the actual print queue on the print server.

CreateXpsDocumentWriter(Double, Double)

Creates an XpsDocumentWriter object with the specified dimensions.

CreateXpsDocumentWriter(PrintDocumentImageableArea, PageRangeSelection, PageRange)

Creates an XpsDocumentWriter object, opens a Windows common print dialog, provides the dialog with a page range and a description of the print job, and returns a ref (ByRef in Visual Basic) parameter that represents information about the imageable area and the dimensions of the media.

CreateXpsDocumentWriter(PrintDocumentImageableArea)

Creates an XpsDocumentWriter object, opens a Windows common print dialog and returns a ref (ByRef in Visual Basic) parameter that represents information about the imageable area and the dimensions of the media.

CreateXpsDocumentWriter(PrintQueue)

Creates an XpsDocumentWriter object and associates it with the specified print queue.

CreateXpsDocumentWriter(String, PrintDocumentImageableArea, PageRangeSelection, PageRange)

Creates an XpsDocumentWriter object, opens a Windows common print dialog, provides the dialog with a page range, and returns a ref (ByRef in Visual Basic) parameter that represents information about the imageable area and the dimensions of the media.

CreateXpsDocumentWriter(String, PrintDocumentImageableArea)

Creates an XpsDocumentWriter object, opens a Windows common print dialog (and provides it a job description) and returns a ref (ByRef in Visual Basic) parameter that represents information about the imageable area and the dimensions of the media.

Dispose()

Releases all resources used by the PrintSystemObject.

(Inherited from PrintSystemObject)
Dispose(Boolean)

Releases the unmanaged resources used by the PrintSystemObject and optionally releases the managed resources.

(Inherited from PrintSystemObject)
Equals(Object)

Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetJob(Int32)

Gets the print job with the specified ID number.

GetPrintCapabilities()

Gets a PrintCapabilities object that identifies the capabilities of the printer.

GetPrintCapabilities(PrintTicket)

Gets a PrintCapabilities object that identifies the capabilities of the printer.

GetPrintCapabilitiesAsXml()

Gets a MemoryStream object that specifies the printer's capabilities as an XML stream that complies with the Print Schema.

GetPrintCapabilitiesAsXml(PrintTicket)

Gets a MemoryStream object that specifies the printer's capabilities in an XML format that complies with the Print Schema.

GetPrintJobInfoCollection()

Creates a collection that contains a PrintSystemJobInfo object for each job in the queue.

GetType()

Gets the Type of the current instance.

(Inherited from Object)
Initialize()

Initializes the properties of the PrintSystemObject.

(Inherited from PrintSystemObject)
InternalDispose(Boolean)

Releases the unmanaged resources used by the PrintQueue and optionally releases the managed resources.

MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
MergeAndValidatePrintTicket(PrintTicket, PrintTicket, PrintTicketScope)

Merges two PrintTickets and guarantees that the resulting PrintTicket is valid, does not ask for any printing functionality that the printer does not support, and is limited to the specified scope.

MergeAndValidatePrintTicket(PrintTicket, PrintTicket)

Merges two PrintTickets and guarantees that the resulting PrintTicket is valid and does not ask for any printing functionality that the printer does not support.

Pause()

Pauses the print queue. It remains paused until Resume() is executed.

Purge()

Removes all the jobs in the print queue.

Refresh()

Updates the properties of the PrintQueue object with values from the printer and the print queue utility that runs on the computer.

Resume()

Restarts a print queue that was paused.

ToString()

Returns a string that represents the current object.

(Inherited from Object)

Applies to

See also