PrintQueueStream 类

定义

一个流,表示打印队列中进行后台处理的打印作业。A stream that represents a spooled print job in a print queue.

public ref class PrintQueueStream : System::IO::Stream
public class PrintQueueStream : System.IO.Stream
type PrintQueueStream = class
    inherit Stream
Public Class PrintQueueStream
Inherits Stream
继承
PrintQueueStream

注解

使用此类可将特定于设备的信息写入 Microsoft WindowsMicrosoft Windows 后台处理程序未自动包含的假脱机文件中。Use this class to write device specific information to a spool file that is not automatically included by the Microsoft WindowsMicrosoft Windows spooler. 当然,您需要知道假脱机文件是 增强型图元文件 (EMF)Enhanced Metafile (EMF) 还是 XML 纸张规范 (XPS)XML Paper Specification (XPS)Of course, you need to know whether the spool file is 增强型图元文件 (EMF)Enhanced Metafile (EMF) or XML 纸张规范 (XPS)XML Paper Specification (XPS). 如果你更喜欢使用 Byte 数组,还可以使用 AddJob 方法的两个重载,并使用 JobStream 属性写入到假脱机文件。If you prefer working with a Byte array, you can also use two of the overloads of the AddJob method and the JobStream property to write to the spool file.

注意

不支持在 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.

构造函数

PrintQueueStream(PrintQueue, String)

为指定的 PrintQueueStream 中承载的指定打印作业初始化 PrintQueue 类的一个新实例。Initializes a new instance of the PrintQueueStream class for the specified print job that is hosted in the specified PrintQueue.

PrintQueueStream(PrintQueue, String, Boolean)

为指定的 PrintQueueStream 中承载的指定打印作业初始化 PrintQueue 类的一个新实例,且指示 PrintQueueStream 中的数据是否应在关闭流时提交。Initializes a new instance of the PrintQueueStream class for the specified print job that is hosted in the specified PrintQueue, with an indication of whether data in the PrintQueueStream should be committed when the stream is closed.

PrintQueueStream(PrintQueue, String, Boolean, PrintTicket)

为指定的 PrintQueueStream 中承载的指定打印作业初始化 PrintQueue 类的一个新实例,且指定的设置指示 PrintQueueStream 中的数据是否应在关闭流时提交。Initializes a new instance of the PrintQueueStream class for the specified print job that is hosted in the specified PrintQueue, with the specified settings and an indication of whether data in the PrintQueueStream should be committed when the stream is closed.

属性

CanRead

获取一个值,该值指示流是否支持读取。Gets a value that indicates whether the stream supports reading.

CanSeek

获取一个指示流是否支持查找的值,该值会将读/写位置移动到流中的新位置。Gets a value that indicates whether the stream supports seeking, which is moving the read/write position to a new position in the stream.

CanTimeout

获取一个值,该值确定当前流是否可以超时。Gets a value that determines whether the current stream can time out.

(继承自 Stream)
CanWrite

获取一个值,该值指示流是否支持写入。Gets a value that indicates whether the stream supports writing.

JobIdentifier

获取打印作业的 ID 号。Gets the ID number of the print job.

Length

获取流的长度(以字节为单位)。Gets the length of the stream in bytes.

Position

获取或设置流中的当前读取/写入位置。Gets or sets the current read/write position in the stream.

ReadTimeout

获取或设置一个值(以毫秒为单位),该值确定流在超时前将尝试读取的时间。Gets or sets a value, in milliseconds, that determines how long the stream will attempt to read before timing out.

(继承自 Stream)
WriteTimeout

获取或设置一个值(以毫秒为单位),该值确定流在超时前将尝试写入多长时间。Gets or sets a value, in milliseconds, that determines how long the stream will attempt to write before timing out.

(继承自 Stream)

方法

BeginRead(Byte[], Int32, Int32, AsyncCallback, Object)

开始执行异步读取操作。Begins an asynchronous read operation. (请考虑改用 ReadAsync(Byte[], Int32, Int32)。)(Consider using ReadAsync(Byte[], Int32, Int32) instead.)

(继承自 Stream)
BeginWrite(Byte[], Int32, Int32, AsyncCallback, Object)

开始执行异步写入操作。Begins an asynchronous write operation.

Close()

关闭流并释放与之关联的所有资源(如套接字和文件句柄)。Closes the stream and releases any resources, such as sockets and file handles, that are associated with it.

CopyTo(Stream)

从当前流中读取字节并将其写入到另一流中。Reads the bytes from the current stream and writes them to another stream.

(继承自 Stream)
CopyTo(Stream, Int32)

使用指定的缓冲区大小,从当前流中读取字节并将其写入到另一流中。Reads the bytes from the current stream and writes them to another stream, using a specified buffer size.

(继承自 Stream)
CopyToAsync(Stream)

从当前流中异步读取字节并将其写入到另一个流中。Asynchronously reads the bytes from the current stream and writes them to another stream.

(继承自 Stream)
CopyToAsync(Stream, CancellationToken)

通过指定的取消令牌,从当前流中异步读取字节并将其写入到另一个流中。Asynchronously reads the bytes from the current stream and writes them to another stream, using a specified cancellation token.

(继承自 Stream)
CopyToAsync(Stream, Int32)

使用指定的缓冲区大小,从当前流中异步读取字节并将其写入到另一流中。Asynchronously reads the bytes from the current stream and writes them to another stream, using a specified buffer size.

(继承自 Stream)
CopyToAsync(Stream, Int32, CancellationToken)

使用指定的缓冲区大小和取消令牌,从当前流中异步读取字节并将其写入到另一个流中。Asynchronously reads the bytes from the current stream and writes them to another stream, using a specified buffer size and cancellation token.

(继承自 Stream)
CreateObjRef(Type)

创建一个对象,该对象包含生成用于与远程对象进行通信的代理所需的全部相关信息。Creates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object.

(继承自 MarshalByRefObject)
CreateWaitHandle()

分配 WaitHandle 对象。Allocates a WaitHandle object.

(继承自 Stream)
Dispose()

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

(继承自 Stream)
Dispose(Boolean)

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

DisposeAsync()

异步释放 Stream 使用的非托管资源。Asynchronously releases the unmanaged resources used by the Stream.

(继承自 Stream)
EndRead(IAsyncResult)

等待挂起的异步读取操作完成。Waits for the pending asynchronous read to complete. (请考虑改用 ReadAsync(Byte[], Int32, Int32)。)(Consider using ReadAsync(Byte[], Int32, Int32) instead.)

(继承自 Stream)
EndWrite(IAsyncResult)

结束执行异步写入操作。Ends an asynchronous write operation.

Equals(Object)

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

(继承自 Object)
Finalize()

使 PrintQueueStream 在垃圾回收已收回 PrintQueueStream 之前尝试释放资源并执行其他清理操作。Enables a PrintQueueStream to attempt to free resources and perform other cleanup operations before the PrintQueueStream is reclaimed by garbage collection.

Flush()

清除此流的所有缓冲区并将所有缓冲数据都写入基础设备中。Clears all the buffers for this stream and writes any buffered data to the underlying device.

FlushAsync()

异步清除此流的所有缓冲区并导致所有缓冲数据都写入基础设备中。Asynchronously clears all buffers for this stream and causes any buffered data to be written to the underlying device.

(继承自 Stream)
FlushAsync(CancellationToken)

异步清理这个流的所有缓冲区,并使所有缓冲数据写入基础设备,并且监控取消请求。Asynchronously clears all buffers for this stream, causes any buffered data to be written to the underlying device, and monitors cancellation requests.

(继承自 Stream)
GetHashCode()

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

(继承自 Object)
GetLifetimeService()

检索控制此实例的生存期策略的当前生存期服务对象。Retrieves the current lifetime service object that controls the lifetime policy for this instance.

(继承自 MarshalByRefObject)
GetType()

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

(继承自 Object)
HandlePackagingProgressEvent(Object, PackagingProgressEventArgs)

通过处理 PrintQueueStream,使 PackagingProgressEvent 响应打包过程。Enables the PrintQueueStream to respond to the packaging progress by handling the PackagingProgressEvent.

InitializeLifetimeService()

获取生存期服务对象来控制此实例的生存期策略。Obtains a lifetime service object to control the lifetime policy for this instance.

(继承自 MarshalByRefObject)
MemberwiseClone()

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

(继承自 Object)
MemberwiseClone(Boolean)

创建当前 MarshalByRefObject 对象的浅表副本。Creates a shallow copy of the current MarshalByRefObject object.

(继承自 MarshalByRefObject)
ObjectInvariant()

提供对 Contract 的支持。Provides support for a Contract.

(继承自 Stream)
Read(Byte[], Int32, Int32)

从流中读取字节序列,并按所读取的字节数向前移动在流中的读/写位置。Reads a sequence of bytes from the stream and advances the read/write position in the stream by the number of bytes that were read.

Read(Span<Byte>)

当在派生类中重写时,从当前流读取字节序列,并将此流中的位置提升读取的字节数。When overridden in a derived class, reads a sequence of bytes from the current stream and advances the position within the stream by the number of bytes read.

(继承自 Stream)
ReadAsync(Byte[], Int32, Int32)

从当前流异步读取字节序列,并将流中的位置提升读取的字节数。Asynchronously reads a sequence of bytes from the current stream and advances the position within the stream by the number of bytes read.

(继承自 Stream)
ReadAsync(Byte[], Int32, Int32, CancellationToken)

从当前流异步读取字节的序列,将流中的位置提升读取的字节数,并监视取消请求。Asynchronously reads a sequence of bytes from the current stream, advances the position within the stream by the number of bytes read, and monitors cancellation requests.

(继承自 Stream)
ReadAsync(Memory<Byte>, CancellationToken)

从当前流异步读取字节的序列,将流中的位置提升读取的字节数,并监视取消请求。Asynchronously reads a sequence of bytes from the current stream, advances the position within the stream by the number of bytes read, and monitors cancellation requests.

(继承自 Stream)
ReadByte()

从流中读取一个字节,并将流内的位置向前提升一个字节,或者如果已到达流结尾,则返回 -1。Reads a byte from the stream and advances the position within the stream by one byte, or returns -1 if at the end of the stream.

(继承自 Stream)
Seek(Int64, SeekOrigin)

设置流中的读取/写入位置。Sets the read/write position within the stream.

SetLength(Int64)

设置流的长度。Sets the length of the stream.

ToString()

返回一个表示当前对象的 string。Returns a string that represents the current object.

(继承自 Object)
Write(Byte[], Int32, Int32)

将字节序列写入流,并按所写入的字节数向前移动在流中的读/写位置。Writes a sequence of bytes to the stream and advances the read/write position in the stream by the number of bytes that are written.

Write(ReadOnlySpan<Byte>)

当在派生类中重写时,向当前流中写入字节序列,并将此流中的当前位置提升写入的字节数。When overridden in a derived class, writes a sequence of bytes to the current stream and advances the current position within this stream by the number of bytes written.

(继承自 Stream)
WriteAsync(Byte[], Int32, Int32)

将字节序列异步写入当前流,并将流的当前位置提升写入的字节数。Asynchronously writes a sequence of bytes to the current stream and advances the current position within this stream by the number of bytes written.

(继承自 Stream)
WriteAsync(Byte[], Int32, Int32, CancellationToken)

将字节的序列异步写入当前流,将该流中的当前位置向前移动写入的字节数,并监视取消请求。Asynchronously writes a sequence of bytes to the current stream, advances the current position within this stream by the number of bytes written, and monitors cancellation requests.

(继承自 Stream)
WriteAsync(ReadOnlyMemory<Byte>, CancellationToken)

将字节的序列异步写入当前流,将该流中的当前位置向前移动写入的字节数,并监视取消请求。Asynchronously writes a sequence of bytes to the current stream, advances the current position within this stream by the number of bytes written, and monitors cancellation requests.

(继承自 Stream)
WriteByte(Byte)

将一个字节写入流内的当前位置,并将流内的位置向前提升一个字节。Writes a byte to the current position in the stream and advances the position within the stream by one byte.

(继承自 Stream)

显式接口实现

IDisposable.Dispose()

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

(继承自 Stream)

适用于