PrintQueue 类

定义

管理打印机和打印作业。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
继承

注解

PrintQueue 对象的某些属性表示在计算机上运行的打印队列实用程序的特征,但其他属性表示打印机自身的功能或状态。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. 例如,NumberOfJobs 是打印队列的一个特性,但 Location 是打印机的一个属性。For example, NumberOfJobs is a characteristic of the print queue, but Location is a property of the printer. 打印机的许多属性(例如是否需要用户注意)都需要从打印机本身到 PrintQueue 对象的 Refresh 方法传递给它。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. 此操作应在程序读取相应属性(NeedUserIntervention)前完成。This should be done before the corresponding property (NeedUserIntervention) is read by your program. 同样,当程序更改 PrintQueue 对象的一个或多个属性的值时,必须将该更改写入计算机上的实际打印队列实用工具中。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. Commit 方法执行此操作。Do this with the Commit method.

注意

不支持在 Windows 服务或 ASP.NET 应用程序或服务中使用 System.Printing 命名空间中的类。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.

构造函数

PrintQueue(PrintServer, String)

使用指定的 PrintQueue 和队列名称初始化 PrintServer 类的一个新实例。Initializes a new instance of PrintQueue class using the specified PrintServer and queue name.

PrintQueue(PrintServer, String, Int32)

使用指定 PrintQueue、队列名称和打印架构版本初始化 PrintServer 类的一个新实例。Initializes a new instance of PrintQueue class using the specified PrintServer, queue name, and print schema version.

PrintQueue(PrintServer, String, Int32, PrintSystemDesiredAccess)

使用指定的 PrintQueue、队列名称、打印架构版本和所需访问初始化 PrintServer 类的一个新实例。Initializes a new instance of PrintQueue class using the specified PrintServer, queue name, print schema version, and desired access.

PrintQueue(PrintServer, String, PrintQueueIndexedProperty[])

使用指定的 PrintQueue、队列名称和要初始化的 PrintServer 值的数组初始化 PrintQueueIndexedProperty 类的一个新实例。Initializes a new instance of PrintQueue class using the specified PrintServer, queue name, and array of PrintQueueIndexedProperty values to initialize.

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

使用指定的 PrintQueue、队列名称、要初始化的 PrintServer 值的数组和所需的访问初始化 PrintQueueIndexedProperty 类的一个新实例。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, PrintSystemDesiredAccess)

使用指定 PrintQueue、队列名称和所需访问初始化 PrintServer 类的一个新实例。Initializes a new instance of PrintQueue class using the specified PrintServer, queue name, and desired access.

PrintQueue(PrintServer, String, String[])

使用指定 PrintQueue、队列名称和要初始化的属性名称的数组初始化 PrintServer 类的一个新实例。Initializes a new instance of PrintQueue class using the specified PrintServer, queue name, and array of property names to initialize.

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

使用指定的 PrintQueue、队列名称、属性过滤器和所需访问初始化 PrintServer 类的一个新实例。Initializes a new instance of PrintQueue class using the specified PrintServer, queue name, property filter, and desired access.

属性

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

获取或设置与此 PrintQueue 关联的默认打印机选项。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.

(继承自 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

获取一个用于指示打印队列能否使用 EMF(增强元文件)的值,增强元文件有助于加快数据从打印应用程序流向 Windows 后台程序的速度。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

获取一个值,该值指示是否因为打印机的驱动程序是基于打印概述建立的,所以它使用 XML 纸张规范 (XPS)XML Paper Specification (XPS) 作为其页面描述语言。Gets a value that indicates whether the printer's driver is built on the Printing Overview so it uses XML 纸张规范 (XPS)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.

(继承自 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.

(继承自 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

获取或设置打印机在一天中开始打印作业的最早时间,用协调世界时 (UTC)(也称格林尼治标准时间 [GMT])午夜过后的分钟数表示。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

获取或设置打印机打印作业的最晚时间,用协调世界时 (UTC)(也称格林尼治标准时间 [GMT])午夜过后的分钟数表示。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

获取或设置当前用户的默认 PrintTicket 对象,该对象中包含有关打印作业的详细信息。Gets or sets the current user's default PrintTicket object which contains detailed information about the print job.

方法

AddJob()

将一个内容为 Byte 数组的新(一般命名的)打印作业插入到队列中。Inserts a new (generically named) print job, whose content is a Byte array, into the queue.

AddJob(String)

将一个内容为 Byte 数组的新打印作业插入到队列中。Inserts a new print job, whose content is a Byte array, into the queue.

AddJob(String, PrintTicket)

XML 纸张规范 (XPS)XML Paper Specification (XPS) 文档的新打印作业插入队列中,为其提供指定名称和设置。Inserts a new print job for an XML 纸张规范 (XPS)XML Paper Specification (XPS) Document into the queue, and gives it the specified name and settings.

AddJob(String, String, Boolean)

XML 纸张规范 (XPS)XML Paper Specification (XPS) 文档的一个新的打印作业插入队列中,赋予其指定名称,并指定是否应验证它。Inserts a new print job for an XML 纸张规范 (XPS)XML Paper Specification (XPS) Document into the queue, gives it the specified name, and specifies whether or not it should be validated.

AddJob(String, String, Boolean, PrintTicket)

XML 纸张规范 (XPS)XML Paper Specification (XPS) 文档的新打印作业插入队列中,为其提供指定名称和设置,并指定是否应验证它。Inserts a new print job for an XML 纸张规范 (XPS)XML Paper Specification (XPS) Document into the queue, gives it the specified name and settings, and specifies whether or not it should be validated.

Commit()

PrintQueue 对象的当前属性写入打印服务器上的实际打印队列中。Writes the current properties of the PrintQueue object to the actual print queue on the print server.

CreateXpsDocumentWriter(Double, Double)

创建具有指定维度的 XpsDocumentWriter 对象。Creates an XpsDocumentWriter object with the specified dimensions.

CreateXpsDocumentWriter(PrintDocumentImageableArea)

创建 XpsDocumentWriter 对象,打开 Windows 通用打印对话框并返回 ref(Visual Basic 中为 ByRef)参数,该参数表示有关可绘制区域和介质维度的信息。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(PrintDocumentImageableArea, PageRangeSelection, PageRange)

创建 XpsDocumentWriter 对象,打开 Windows 通用打印对话框,为对话框提供页面范围和打印作业说明,并返回 ref(Visual Basic 中为 ByRef)参数,该参数表示有关可绘制区域和介质维度的信息。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(PrintQueue)

创建一个 XpsDocumentWriter 对象并将其与指定的打印队列关联。Creates an XpsDocumentWriter object and associates it with the specified print queue.

CreateXpsDocumentWriter(String, PrintDocumentImageableArea)

创建 XpsDocumentWriter 对象,打开 Windows 通用打印对话框(同时为其提供一个作业说明)并返回 ref(Visual Basic 中为 ByRef)参数,该参数表示有关可绘制区域和介质维度的信息。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.

CreateXpsDocumentWriter(String, PrintDocumentImageableArea, PageRangeSelection, PageRange)

创建 XpsDocumentWriter 对象,打开 Windows 通用打印对话框,为对话框提供一个页面范围并返回 ref(Visual Basic 中为 ByRef)参数,该参数表示有关可绘制区域和介质维度的信息。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.

Dispose()

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

(继承自 PrintSystemObject)
Dispose(Boolean)

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

(继承自 PrintSystemObject)
Equals(Object)

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

(继承自 Object)
GetHashCode()

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

(继承自 Object)
GetJob(Int32)

获取具有指定 ID 号的打印作业。Gets the print job with the specified ID number.

GetPrintCapabilities()

获取用于标识打印机功能的 PrintCapabilities 对象。Gets a PrintCapabilities object that identifies the capabilities of the printer.

GetPrintCapabilities(PrintTicket)

获取用于标识打印机功能的 PrintCapabilities 对象。Gets a PrintCapabilities object that identifies the capabilities of the printer.

GetPrintCapabilitiesAsXml()

获取一个 MemoryStream 对象,该对象将打印机的功能指定为遵从打印架构的 XML 流。Gets a MemoryStream object that specifies the printer's capabilities as an XML stream that complies with the Print Schema.

GetPrintCapabilitiesAsXml(PrintTicket)

获取一个 MemoryStream 对象,该对象指定 XML 格式的打印机功能,该格式符合打印架构Gets a MemoryStream object that specifies the printer's capabilities in an XML format that complies with the Print Schema.

GetPrintJobInfoCollection()

创建包含队列中每个作业的 PrintSystemJobInfo 对象的集合。Creates a collection that contains a PrintSystemJobInfo object for each job in the queue.

GetType()

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

(继承自 Object)
Initialize()

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

(继承自 PrintSystemObject)
InternalDispose(Boolean)

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

MemberwiseClone()

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

(继承自 Object)
MergeAndValidatePrintTicket(PrintTicket, PrintTicket)

合并两种 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.

MergeAndValidatePrintTicket(PrintTicket, PrintTicket, PrintTicketScope)

合并两种 PrintTicket,保证所得的 PrintTicket 有效,不请求打印机所不支持的任何打印功能,且限于指定的作用域。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.

Pause()

暂停打印队列。Pauses the print queue. 它保持暂停状态,直到执行 Resume() 为止。It remains paused until Resume() is executed.

Purge()

移除打印队列中的所有作业。Removes all the jobs in the print queue.

Refresh()

使用来自打印机的值和计算机上运行的打印队列实用工具更新 PrintQueue 对象的属性。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.

(继承自 Object)

适用于

另请参阅