Using Xps
Common Scenarios in Xps
Overview Printing Loading Serializing Manipulating
Session Goals Outline Common Scenarios Highlight Developer Choices Warn of Common Mistakes
Printing PrintDialog
XpsDocumentWriter
Simple
Controlled/Advanced
Synchronous
Asynchronous
Works in Partial Trust
Special Case for Partial Trust
No Access to Print Tickets
Access to Print Tickets
Print Queue Entry point to advanced printing Can be accessed from the Print Dialog Access to Print Capabilities Access to Status Access to default Print Ticket
Asynchronous Printing Progress call backs Cancel call backs Completion callbacks
Print Ticket Reading user settings from Print Tickets Associating print tickets during printing Acquiring default Print tickets No Print Ticket in Partial Trust DeDe-serialization does not maintain print tickets
Orientation and Layout Objects may need to be translated to fit in the visible area. XPS Serialization does not rere-layout based on orientation The drawing is clipped to the union of the viewable area and the rectangle defined by the fixed page size. Some Options Transform the Fixed Page ReRe-Layout the Fixed Page
Loading Xps Deferred Loading Using the Package Store Using Xaml Parser
Deferred Loading Documents and Pages are loaded on access The Fixed Class maintain only weak references
Package Store The Package Store prevents the need to continually rere-open the Package to access the internal parts. Keep documents open until though displaying them. Creating an Xps Document with a stream requires the user to manage the Package Store Loading Xps Documents with out the package in the Package store works but is very slow.
Serialization Write once “Fixed� content Fonts are subsub-set Some Fonts are restricted Documents can be interleaved for simultaneous production and consumption
Font Subsetting All the needed fonts are stored in the document. Only the needed glyphs are stored in the fonts. Printing might need different levels of granularity on subsub-setting
Restricted Fonts Licensing Right Intent Installable embedding Restricted license embedding – Relationship Preview and print embedding - Obfuscated Editable embedding No subsetting Bitmap embedding only – glyphs converted to images
Interleaving Triggered by opening document with Write access. Used for simultaneous generation and consumption. “Image Last” Last” option designed for Web consumption
Processing Xps Documents Displaying Signing Merging Generating Thumbnails
Displaying Xps Components Simple – DocumentViewer Pages are Visuals that can be displayed through visual brushes
Signing Acquiring a certificate Iterating the Signature Definitions Effectively using IsSignable Testing if a signature is valid
Merging New documents can be created from other documents This technique only works if the source documents are serialized (not formed in memory)
Generating Thumbnails Create a bitmap of a page by render to target Encode the bitmap to a jpeg using encoders Write the stream to an Xps Thumbnail
Š 2006 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.