WS2008: Understanding XML Paper Specification (XPS)

WS2008: Understanding XML Paper Specification (XPS)

  • Comments 10
  • Likes

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 :

EDITS:

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)

Your comment has been posted.   Close
Thank you, your comment requires moderation so it may take a while to appear.   Close
Leave a Comment
  • go ahead and print this out of ie7 to the vista xps printer and then view it. it won't display correctly. the screenshot is cut off.

  • PingBack from http://all-in-one-printer.jfcforum.com/2008/02/09/ws2008-understanding-xml-paper-specification-xps/

  • CC Hameed on the server perf team (although, more properly, I think that should be the Enterprise Platforms

  • CC Hameed on the server perf team (although, more properly, I think that should be the Enterprise Platforms

  • Server 2008's IE7.0.6001.18000 (fully updated to 30 April, 2008) refuses to display ANY XPS files, including the test page printed from the XPS Document Writer. It merely offers to 'Save' the document. I've 'enabled' XPS in Internet Options / Security.

    IE 7.0.5730.11 on XP has no such problems.

    Unimpressed!

  • Could somebody please tell me why WPF doesn't allow for Print Preview? I have a canvas defined with XAML that I can print but I can't Print Preview it! I can't save the canvas to a XPS file which means I can't view my canvas in a DocumentViewer (which only can contain an XPS file).

  • For Server 2008 the download link above doesn't work. The 64-bit version of Microsoft XPS Essentials Pack displays a message that it is not compatible with this version, and the Microsoft XPS Viewer displays an error saying that the XPS viewer must be added using Server Manager Features.

    Unfortunately this didn't work out-of-box because I had previously tried Photo Gallery Viewer (which pointed me to the Microsoft XPS Essentials Pack which wouldn't install). After some fiddling (associate XPS with IE rather than the XPSViewer.exe) I can now XPS files.

  • How would you print an xps file from a win32 application on windows XP? I've looked through everything I can find, but I can't get it to work...

  • This page fails to load properly with a Silverlight Error and I have to cancel the debugger launch window 6 times in a row!

    The error is:

    An unhandled exception ('Unhandled exception in Silverlight 2 Application [Format_BadTime] ... (no more data but a message about debugging arguments not  present... in spanish)

    Maybe a locale or IE 8 problem?

    Page URL: http://blogs.technet.com/askperf/archive/2008/02/09/ws2008-understanding-xml-paper-specification-xps.aspx

    Vista 32 Spanish

    * IE8 Final *

  • Jorge -

    Are you getting the Silverlight error on every page or just that specific page?  There isn't any Silverlight code within the actual post, only in the right hand sidebar with the Twitter app - and that appears on every page, so I'm a bit puzzled if you're only seeing the issue on that page.

    - CC