XPS Document Classes
The classes for working with XPS documents are spread across several namespaces, because there are several different levels at which you may wish to work. Table 15-1 shows the various namespaces that contain XPS functionality, and the scenarios for which they are intended.
Table 15-1. Namespaces for working with XPS
Namespace | Purpose of classes |
---|---|
System.Windows.Documents | Contains classes that represent the logical internal structure of XPS documents, and which also add extra runtime functionality for constructing documents |
System.Windows.Xps | Abstract API for creating XPS documents, for either printing or writing to disk |
System.Windows.Xps.Serialization | Provides fine-grained control of how the XPS file's contents are generated |
System.Windows.Xps.Packaging | Provides access to package-level aspects of XPS, such as loading and saving XPS documents, or adding thumbnail images |
System.IO.Packaging | Allows reading and writing of any OPC file (not limited to XPS) |
XPS file structure is most directly represented by the classes in
the System.Windows.Xps.Packaging
namespace. If you want to work directly with the streams of data that
make up an XPS file, these classes will give you the most control.
However, they are not all that convenient to use because of their
low-level nature. There is an even lower level beneath the XPS packaging
classes: the System.IO.Packaging
namespace implements OPC. This is the foundation on which the XPS packaging classes are built. Although you could use the lowest-level ...
Get Programming WPF, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.