WS2008: Understanding XML Paper Specification (XPS)

It’s Day Nine of our Windows Server 2008 series.  We’re one-third of the way through our series.  Today we will continue on with our look at printing in Windows Server 2008.  Our topic today – XML Paper Specification (XPS) Support.

The XML Paper Specification (XPS) defines an open document format that uses Extensible Markup Language (XML) to create a document format that is platform-independent, openly-published and royalty-free.  The XPS format consists of XML markup that defines the composition of a document and visual appearance of each page along with rendering rules for displaying or printing the document.  XPS Support in Windows Server 2008 provides a new foundation for applications that are based on the Windows Presentation Foundation (WPF) graphics subsystem that was introduced in Windows Vista.  XPS Support enhances the print architecture of Windows Vista and Windows Server 2008 by improving print fidelity and performance while retaining support for the GDI-based print subsystem used in previous version of Windows.

The XPS print architecture addresses the following long-term market directions and customer requirements for printing:

  • Increased demand for color laser printing
  • Increased demand for true color fidelity
  • Increased use of advanced graphics and color

There are some key features of the new XPS technologies to be aware of.  The XPS viewer can be used to view, manage and print XPS documents.  The XPS viewer may be installed as a .NET Framework 3.0 feature on Windows Server 2008.  It is installed by default on Windows Vista.  To enable XPS features on Windows XP and Windows Server 2003, the XPS Viewer and XPS Essentials pack can be downloaded from the Microsoft web site.  The XPS Viewer is built upon the WPF DocumentViewer control that is included in the .NET Framework 3.0 runtime components and is implemented as an eXtensible Application Markup Language (XAML) Browser Application (XBAP) that runs in Internet Explorer as shown in the image below.

Basically, XPSViewer.exe is a wrapper for the DocumentViewer control with additional UI controls for various features.  Please note that XPSViewer.exe is a 32-bit only process.

The Microsoft XPS Document Writer print driver allows XPS documents to be generated from any application with print capabilities.  Thus, even an application that is not written for the Windows Presentation Foundation can create an XPS document by printing to the XPS Document file writer.

There is also a new XPS-based print path that can provide better performance and improved print fidelity when compared to the earlier GDI-based print path and Win32 (GDI) applications.  When installed, the XPS Document Writer appears as an available print queue through the print command in an application.  When used as the printer, the driver prompts the user for an output file name and creates an XPS document (with a .xps extension) that captures the print output of the application.  By default, the Microsoft XPS Document Writer is installed on Windows Vista and Windows Server 2008.  For Windows XP and Windows Server 2003, installing the .NET Framework 3.0 or the XPS Essentials pack will add the Microsoft XPS Document Writer.

So where’s the payoff?  How does XPS really improve the Windows Printing Experience?  Remember that we mentioned high-fidelity and high-performance printing for Windows users?  The print subsystem in Windows Vista and Windows Server 2008 provides an extensible platform for partner innovation.  Major printer hardware vendors are expected to release a new generation of XPS-based printers using the new XPS driver model in the near future.  This is not to say that the currently (large) installed base of traditional GDI-based printers are incompatible with Windows Vista and Windows Server 2008.  However, the consistent use of XPS technology throughout the system eliminates the need for conversion between and application and a printer – making it possible to deliver a true WYSIWYG (What You See Is What You Get) experience.  Prior to Windows Vista and Windows Server 2008, a document being sent to a printer had to undergo a number of translations and transformations.  For example, GDI-based printer drivers must transform image data to the 8-bit-per-channel, red-green-blue (RGB) color space supported by GDI.  This leads to the inherent loss of color fidelity.  Graphics processing in the XPS print path is not limited to using only GDI functions.  XPS Printer Drivers can support up to 32-bits per channel by using the Windows Media Photo image format and can provide a direct path to the device for device color support.  As a result, the XPS print path can support more color spaces and greater pixel bit-depth than is possible with GDI.

For text-only documents (or documents with basic graphics), the GDI conversion process is sufficient.  However, with the increased demand for more high-resolution images, drawings, text in multiple fonts and other elements, the graphical processing ability of the print and display paths is critical.  One workaround would be to have the application perform all of the graphics processing and send a RAW data stream to the spooler.  However, this places more of the burden on the application and would require more development as the application would have to handle not only the on-screen image rendering within the application itself but also perform all the print rendering functions.

The XPS print path makes improvements by eliminating the conversion processes inherent to GDI-based printing.  Keeping the format of the document unchanged throughout the entire printing process retains the original quality and fidelity of the document all the way to the printer.  Furthermore, the XPS print path supports a modular architecture that allows application developers to move their print rendering functions out of the application and into the print path.  Here, they can be more efficiently leveraged by other applications or as a standalone product.  Finally, the XPS print path improves the spooler’s efficiency by spooling XPS documents in a native spool format when printing to XPS-enabled printers or drivers.  This simplified process eliminates the requirement to generate an intermediate spool file (such as an EMF data file) before the document is spooled for printing.  Through smaller spool file sizes, the XPS print path can reduce network traffic and improve overall printing performance.  Unlike EMF spooling, the XPS spool format represents the actual visual output without requiring further interpretation when targeting an XPS-based printer driver.  This eliminates the data and color space conversions and loss of fidelity which are experienced when using EMF files and GDI-based print drivers.

That will do it for this post.  Tomorrow, we’ll take a look at Client-Side Rendering.  Until next time …

CC Hameed

Share this post :


2/11/2008:  Although the XPS Viewer is built on WPF and hosted in IE, it is not a regular XBAP application.   In addition, XPS also provides benefits for text applications, for example, because XPS requires that all resources are included within the spool file.  Thus there are no problems with missing device fonts. (Thanks to Adrian Ford for the clarifications)