XpsDocument 类

定义

提供用于保存 XPS 文档内容的 PackageProvides a Package that holds the content of an XPS document.

public ref class XpsDocument : System::Windows::Xps::Packaging::XpsPartBase, IDisposable
public class XpsDocument : System.Windows.Xps.Packaging.XpsPartBase, IDisposable
type XpsDocument = class
    inherit XpsPartBase
    interface IDisposable
Public Class XpsDocument
Inherits XpsPartBase
Implements IDisposable
继承
XpsDocument
实现

注解

包含一个或多个 FixedDocument 元素的 FixedDocumentSequence XpsDocumentAn XpsDocument contains a FixedDocumentSequence that comprises one or more FixedDocument elements.

XpsDocument 构造函数传递对 Package 的引用,用于写入、存储和读取文档的内容元素。The XpsDocument constructor is passed a reference to a Package for writing, storing, and reading the content elements of the document.

使用 Package 构造函数创建新的空 XPSXPS PackageA new empty XPSXPS Package is created by using the Package constructor.

使用 Package.Open 方法打开现有 XPSXPS PackageAn existing XPSXPS Package is opened by using the Package.Open method.

FixedDocumentSequence 根通过调用 AddFixedDocumentSequence 方法添加到空的 XPSXPS Package 中。A FixedDocumentSequence root is added to an empty XPSXPS Package by calling the AddFixedDocumentSequence method.

PrintTicket 包含打印机信息和控件的元素,还可以与 FixedDocumentSequence相关联,或与存储在 XpsDocument中的单个 FixedDocumentFixedPage 元素相关联。PrintTicket elements with printer information and control can also be associated with the FixedDocumentSequence, or on individual FixedDocument and FixedPage elements that are stored in the XpsDocument.

有关 XPSXPS 的详细信息,请参阅可下载https://go.microsoft.com/fwlink/?LinkID=65761的 XML 纸张规范(XPS)。For more information about XPSXPS see the XML Paper Specification (XPS) available for download at https://go.microsoft.com/fwlink/?LinkID=65761.

构造函数

XpsDocument(Package)

通过访问指定的 XML 纸张规范 (XPS) Package 和使用默认的隔行扫描、资源及压缩选项来初始化 XpsDocument 类的新实例。Initializes a new instance of the XpsDocument class with access to a specified XML Paper Specification (XPS) Package and default interleaving, resource, and compression options.

XpsDocument(Package, CompressionOption)

用指定的默认隔行扫描、资源和压缩选项初始化指定 XpsDocument 中包含的 Package 类的新实例。Initializes a new instance of the XpsDocument class that is contained in a specified Package with specified default interleaving, resource, and compression options.

XpsDocument(Package, CompressionOption, String)

用指定的默认隔行扫描、资源和压缩选项初始化指定 XpsDocument 中包含的 Package 类的新实例。Initializes a new instance of the XpsDocument class that is contained in a specified Package with the specified default interleaving, resource, and compression options.

XpsDocument(String, FileAccess)

用默认的隔行扫描、资源和压缩选项初始化指定的 XpsDocument 文件中包含的 Package 类的新实例。Initializes a new instance of the XpsDocument class that is contained in a specified Package file with default interleaving, resource, and compression options.

XpsDocument(String, FileAccess, CompressionOption)

用默认的隔行扫描、资源和压缩选项初始化指定的 XpsDocument 文件中包含的 Package 类的新实例。Initializes a new instance of the XpsDocument class that is contained in a specified Package file with default interleaving, resource, and compression options.

属性

CoreDocumentProperties

获取 XPSXPS 文档的核心 PackagePropertiesGets the core PackageProperties of the XPSXPS document.

FixedDocumentSequenceReader

获取一个用于阅读文档的 IXpsFixedDocumentSequenceReaderGets an IXpsFixedDocumentSequenceReader for reading the document.

IsReader

获取一个值,该值指示包是否可读。Gets a value that indicates whether the package is readable.

IsSignable

获取一个值,该值指示是否可对包进行数字签名。Gets a value that indicates whether the package can be digitally signed.

IsWriter

获取一个值,该值指示包是否可写。Gets a value that indicates whether the package is writable.

Signatures

获取与包关联的 XML 纸张规范 (XPS) 签名的集合。Gets a collection of XML Paper Specification (XPS) signatures that are associated with the package.

Thumbnail

获取或设置与文档关联的 XML 纸张规范 (XPS)XML Paper Specification (XPS) 缩略图像。Gets or sets the XML 纸张规范 (XPS)XML Paper Specification (XPS) thumbnail image that is associated with the document.

Uri

获取或设置部件的统一资源标识符 (URI)。Gets or sets the uniform resource identifier (URI) of the part.

(继承自 XpsPartBase)

方法

AddFixedDocumentSequence()

将根 FixedDocumentSequence 添加到包中并返回一个编写器。Adds a root FixedDocumentSequence to the package and returns a writer.

AddThumbnail(XpsImageType)

向包中添加缩略图像。Adds a thumbnail image to the package.

Close()

关闭 XPS 文档 PackageCloses the XPS document Package.

CreateXpsDocumentWriter(XpsDocument)

创建一个用于编写 XpsDocumentWriterXpsDocumentCreates an XpsDocumentWriter for writing an XpsDocument.

Dispose(Boolean)

释放由 XpsDocument 占用的非托管资源,还可以选择释放托管资源。Releases the unmanaged resources that are used by the XpsDocument and optionally, releases the managed resources.

Equals(Object)

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

(继承自 Object)
GetFixedDocumentSequence()

返回位于包根位置的固定文档序列。Returns the fixed-document sequence at the root of the package.

GetHashCode()

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

(继承自 Object)
GetType()

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

(继承自 Object)
MemberwiseClone()

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

(继承自 Object)
RemoveSignature(XpsDigitalSignature)

从包中删除签名。Deletes a signature from the package.

SignDigitally(X509Certificate, Boolean, XpsDigSigPartAlteringRestrictions)

使用指定的 X.509 证书对包部件集合进行签名。Signs a collection of package parts with a specified X.509 certificate.

SignDigitally(X509Certificate, Boolean, XpsDigSigPartAlteringRestrictions, Guid)

使用指定的 X.509 证书对包部件的集合进行签名。Signs a collection of package parts by using a specified X.509 certificate.

SignDigitally(X509Certificate, Boolean, XpsDigSigPartAlteringRestrictions, Guid, Boolean)

使用指定的 X.509 证书对包部件集合进行签名。Signs a collection of package parts with a specified X.509 certificate.

ToString()

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

(继承自 Object)

显式接口实现

IDisposable.Dispose()

此成员支持 Windows Presentation Foundation (WPF)Windows Presentation Foundation (WPF) 基础结构,但不能在代码中直接使用。This member supports the Windows Presentation Foundation (WPF)Windows Presentation Foundation (WPF) infrastructure and is not intended to be used directly from your code. 改用类型安全的 Dispose(Boolean) 方法。Use the type-safe Dispose(Boolean) method instead.

适用于

另请参阅