PrintQueueStream PrintQueueStream PrintQueueStream PrintQueueStream Class

定义

一个流,表示打印队列中进行后台处理的打印作业。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
继承

注解

使用此类设备特定信息写入到假脱机文件的情况下不会自动包括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.

注意

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

初始化的新实例PrintQueueStream类的指定打印托管的作业中指定PrintQueueInitializes 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, String, Boolean) PrintQueueStream(PrintQueue, String, Boolean) 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, String, Boolean, PrintTicket) PrintQueueStream(PrintQueue, String, Boolean, PrintTicket) 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 CanRead CanRead CanRead

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

CanSeek CanSeek CanSeek 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 CanTimeout CanTimeout CanTimeout

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

(Inherited from Stream)
CanWrite CanWrite CanWrite CanWrite

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

JobIdentifier JobIdentifier JobIdentifier JobIdentifier

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

Length Length Length Length

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

Position Position Position Position

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

ReadTimeout ReadTimeout ReadTimeout ReadTimeout

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

(Inherited from Stream)
WriteTimeout WriteTimeout WriteTimeout WriteTimeout

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

(Inherited from Stream)

方法

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

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

(Inherited from Stream)
BeginWrite(Byte[], Int32, Int32, AsyncCallback, Object) BeginWrite(Byte[], Int32, Int32, AsyncCallback, Object) BeginWrite(Byte[], Int32, Int32, AsyncCallback, Object) BeginWrite(Byte[], Int32, Int32, AsyncCallback, Object)

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

Close() Close() Close() Close()

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

CopyTo(Stream) CopyTo(Stream) CopyTo(Stream) CopyTo(Stream)

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

(Inherited from Stream)
CopyTo(Stream, Int32) CopyTo(Stream, Int32) CopyTo(Stream, Int32) CopyTo(Stream, Int32)

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

(Inherited from Stream)
CopyToAsync(Stream) CopyToAsync(Stream) CopyToAsync(Stream) CopyToAsync(Stream)

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

(Inherited from Stream)
CopyToAsync(Stream, CancellationToken) CopyToAsync(Stream, CancellationToken) CopyToAsync(Stream, CancellationToken) CopyToAsync(Stream, CancellationToken)

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

(Inherited from Stream)
CopyToAsync(Stream, Int32) CopyToAsync(Stream, Int32) CopyToAsync(Stream, Int32) CopyToAsync(Stream, Int32)

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

(Inherited from Stream)
CopyToAsync(Stream, Int32, CancellationToken) CopyToAsync(Stream, Int32, CancellationToken) CopyToAsync(Stream, Int32, CancellationToken) 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.

(Inherited from Stream)
CreateObjRef(Type) CreateObjRef(Type) CreateObjRef(Type) CreateObjRef(Type)

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

(Inherited from MarshalByRefObject)
CreateWaitHandle() CreateWaitHandle() CreateWaitHandle() CreateWaitHandle()

分配 WaitHandle 对象。Allocates a WaitHandle object.

(Inherited from Stream)
Dispose() Dispose() Dispose() Dispose()

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

(Inherited from Stream)
Dispose(Boolean) Dispose(Boolean) Dispose(Boolean) Dispose(Boolean)

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

DisposeAsync() DisposeAsync() DisposeAsync() DisposeAsync()

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

(Inherited from Stream)
EndRead(IAsyncResult) EndRead(IAsyncResult) EndRead(IAsyncResult) EndRead(IAsyncResult)

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

(Inherited from Stream)
EndWrite(IAsyncResult) EndWrite(IAsyncResult) EndWrite(IAsyncResult) EndWrite(IAsyncResult)

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

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

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

(Inherited from Object)
Finalize() Finalize() Finalize() 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() Flush() Flush() Flush()

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

FlushAsync() FlushAsync() FlushAsync() FlushAsync()

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

(Inherited from Stream)
FlushAsync(CancellationToken) FlushAsync(CancellationToken) FlushAsync(CancellationToken) FlushAsync(CancellationToken)

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

(Inherited from Stream)
GetHashCode() GetHashCode() GetHashCode() GetHashCode()

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

(Inherited from Object)
GetLifetimeService() GetLifetimeService() GetLifetimeService() GetLifetimeService()

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

(Inherited from MarshalByRefObject)
GetType() GetType() GetType() GetType()

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

(Inherited from Object)
HandlePackagingProgressEvent(Object, PackagingProgressEventArgs) HandlePackagingProgressEvent(Object, PackagingProgressEventArgs) HandlePackagingProgressEvent(Object, PackagingProgressEventArgs) HandlePackagingProgressEvent(Object, PackagingProgressEventArgs)

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

InitializeLifetimeService() InitializeLifetimeService() InitializeLifetimeService() InitializeLifetimeService()

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

(Inherited from MarshalByRefObject)
MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

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

(Inherited from Object)
MemberwiseClone(Boolean) MemberwiseClone(Boolean) MemberwiseClone(Boolean) MemberwiseClone(Boolean)

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

(Inherited from MarshalByRefObject)
ObjectInvariant() ObjectInvariant() ObjectInvariant() ObjectInvariant()

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

(Inherited from Stream)
Read(Byte[], Int32, Int32) Read(Byte[], Int32, Int32) Read(Byte[], Int32, Int32) 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>) Read(Span<Byte>) Read(Span<Byte>) 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.

(Inherited from Stream)
ReadAsync(Byte[], Int32, Int32) ReadAsync(Byte[], Int32, Int32) ReadAsync(Byte[], Int32, Int32) 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.

(Inherited from Stream)
ReadAsync(Byte[], Int32, Int32, CancellationToken) ReadAsync(Byte[], Int32, Int32, CancellationToken) ReadAsync(Byte[], Int32, Int32, CancellationToken) 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.

(Inherited from Stream)
ReadAsync(Memory<Byte>, CancellationToken) ReadAsync(Memory<Byte>, CancellationToken) ReadAsync(Memory<Byte>, CancellationToken) 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.

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

(Inherited from Stream)
Seek(Int64, SeekOrigin) Seek(Int64, SeekOrigin) Seek(Int64, SeekOrigin) Seek(Int64, SeekOrigin)

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

SetLength(Int64) SetLength(Int64) SetLength(Int64) SetLength(Int64)

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

ToString() ToString() ToString() ToString()

返回表示当前对象的字符串。Returns a string that represents the current object.

(Inherited from Object)
Write(Byte[], Int32, Int32) Write(Byte[], Int32, Int32) Write(Byte[], Int32, Int32) 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>) Write(ReadOnlySpan<Byte>) Write(ReadOnlySpan<Byte>) 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.

(Inherited from Stream)
WriteAsync(Byte[], Int32, Int32) WriteAsync(Byte[], Int32, Int32) WriteAsync(Byte[], Int32, Int32) 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.

(Inherited from Stream)
WriteAsync(Byte[], Int32, Int32, CancellationToken) WriteAsync(Byte[], Int32, Int32, CancellationToken) WriteAsync(Byte[], Int32, Int32, CancellationToken) 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.

(Inherited from Stream)
WriteAsync(ReadOnlyMemory<Byte>, CancellationToken) WriteAsync(ReadOnlyMemory<Byte>, CancellationToken) WriteAsync(ReadOnlyMemory<Byte>, CancellationToken) 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.

(Inherited from Stream)
WriteByte(Byte) WriteByte(Byte) WriteByte(Byte) WriteByte(Byte)

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

(Inherited from Stream)

显式界面实现

IDisposable.Dispose() IDisposable.Dispose() IDisposable.Dispose() IDisposable.Dispose()

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

(Inherited from Stream)

适用于