This post is migrated from previous hosting provider. There are still some issues with old posts. Please make a comment on this post with any issues.

Dissecting XPS, part 1 - The basics

Tags: Microsoft, .NET, XML, Microsoft Office, Windows Vista, XPS

XPS I will in a number of posts try to explain the XML Paper Specification document format, XPS format, that has been developed by Microsoft.

I think the XPS initiative is nice from a developer and ISV perspective, since creating and reading XPS documents is easy and supported from various environments. This series of XPS articles will start off with an introduction to the XML Paper Specification and then continue with general support and competitors and then of course some nice introduction on how to use XPS in applications.

As of today the XPS format is not even near the Adobe PDF format in usage, but the recent introduction of Windows Vista, which contains a built-in reader, and Microsoft Office 2007, which can generate XPS documents, will at least close the gap. 

What is the XML Paper Specification?

The XML Paper specification is an effort from the software giant Microsoft to make an open, royalty free, cross-platform document format. An XPS document is a "paginated representation of an electronic document"[1]. With the XPS format everyone can create XPS document which can be read and printed by anyone who or anything whic has an XPS reader and/or XPS capable printer. XPS documents can also be digitally signed and contain advanced coloring for printing and much more.

Creating XPS documents is easy and royalty-free which means that ISV's and application developers easy can integrate XPS import and/or export into their applications.

Now over to the interesting stuff...

The XPS Document format

XPS is based on the Open Packaging Conventions[2] which essentially is a ZIP compressed set of XML files. This is the same package format that the new Microsoft Office 2007 document formats use (for example .docx and .xlsx). The specificatíon for this "describes an abstract model and physical format...to organize the content and resources of a document within a package" [2]. The abstract model describes Packages which is a logical entity consisting of Parts and their Relationships and the physical model describes basically how the Package is physically stored.

Every Part has a Content Type, which identifies the type of content that is stored in the Part. For example a part can be the document markup, an image or any other embedded content.

Content of the XPS specification document.The physical file is a standard ZIP file (just rename any .xps or .dotx file to .zip and open it) with the parts and relationships as files. The different parts will be represented as files. For example; the image in the above example will be an actual image file in the ZIP package and the content will be represented by an XML file.

To the right is a screenshot from the content of the XML Paper Specification 1.0 .XPS document. As you can see there are files and folders which represents the Parts.

How can I start creating XPS documents

Microsoft XPS Document Writer If you have Microsoft Office 2007 you can start creating XPS documents after downloading an optional update[5], which adds the Save As XPS to your Office applications. If you have Windows Vista you can use the XPS print driver to print anything to an XPS document. If you have Windows XP or Windows Server 2003 you can download the XML Paper Specification Essentials Pack[6] which includes the Microsoft XPS Document Writer.

If you would like to convert an RSS feed into a document you can go to RSS2XPS.com which allows you to convert a feed into an XPS document.

Next article...

Next article in this series, which should appear within a week, will focus more on the XPS Parts and Relationships within a XPS document. 

Further reading and References

[1] XPS Specification and License downloads[2] Ecma Office Open XML File Formats Standard[3] XML Paper Specification[4] XPS Viewer for Windows XP or Windows Server 2003[5] 2007 Microsoft Office Add-in: Microsoft Save as PDF or XPS[6] Microsoft XML Paper Specification Essentials Pack Version 1.0

No Comments

Comments have been disabled for this content.

About Wictor...

Wictor Wilén is a Director and SharePoint Architect working at Connecta AB. Wictor has achieved the Microsoft Certified Architect (MCA) - SharePoint 2010, Microsoft Certified Solutions Master (MCSM) - SharePoint  and Microsoft Certified Master (MCM) - SharePoint 2010 certifications. He has also been awarded Microsoft Most Valuable Professional (MVP) for four consecutive years.

And a word from our sponsors...

SharePoint 2010 Web Parts in Action