All formats

XPS (XML Paper Specification) and OpenXPS

Full nameXML Paper Specification; OpenXPS (Open XML Paper Specification, ECMA-388)
Extensions.xps, .oxps
MIME typeapplication/vnd.ms-xpsdocument (XPS), application/oxps (OpenXPS)
Typefixed-layout document (vector graphics, text with embedded fonts, images) in a ZIP package
Starts with50 4B 03 04 (PK, a ZIP file); identified by the [Content_Types].xml part and a fixedrepresentation relationship
SpecificationECMA-388 Open XML Paper Specification
Maintained byEcma International (TC46); Microsoft for the original XPS 1.0
Licenseopen standard (Microsoft covers XPS under its Open Specification Promise)

XPS is Microsoft’s answer to PDF: a page description format where every page is fixed, fonts are embedded and the file looks the same everywhere. It’s built on the same packaging as Office Open XML: a ZIP file with XML parts. Pages are written in a subset of XAML with three drawing elements: Path, Glyphs and Canvas.

XPS is part of the Windows print system. The Microsoft XPS Document Writer printer saves any document as .oxps (Windows 8 and later) or .xps (Windows 7), and the XPS print path sends XPS to printer drivers. OpenXPS (ECMA-388) is the standardized version of XPS 1.0 with new XML namespaces; the two are otherwise almost the same. Outside Windows printing, XPS is rare: use PDF for documents you share.

When to use XPS#

File structure#

An XPS document is an Open Packaging Conventions (OPC) package: a ZIP archive of parts, with relationships between them. A typical .xps file made by the XPS Document Writer:

[Content_Types].xml                     MIME type of every part, by extension or name
_rels/.rels                             start relationship -> FixedDocumentSequence.fdseq
FixedDocumentSequence.fdseq             list of documents
Documents/1/FixedDocument.fdoc          list of pages with their sizes
Documents/1/Pages/1.fpage               page 1 markup
Documents/1/Pages/_rels/1.fpage.rels    resources used by page 1
Documents/1/Resources/Fonts/0A1B2C3D-....odttf   embedded (obfuscated) font
Documents/1/Resources/Images/1.png      image
Documents/1/Structure/DocStructure.struct        optional outline (bookmarks)
docProps/core.xml                       title, author, dates (core properties)
Metadata/Job_PT.xml                     PrintTicket: paper, duplex, copies

Part names and folder layout vary between producers; only the relationships are fixed. A reader finds the start part from _rels/.rels:

XML
<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
  <Relationship Id="R0" Target="/FixedDocumentSequence.fdseq"
    Type="http://schemas.microsoft.com/xps/2005/06/fixedrepresentation"/>
</Relationships>

OpenXPS uses the relationship type http://schemas.openxps.org/oxps/v1.0/fixedrepresentation instead.

Documents and pages#

The document sequence lists documents, each document lists pages:

XML
<FixedDocumentSequence xmlns="http://schemas.microsoft.com/xps/2005/06">
  <DocumentReference Source="Documents/1/FixedDocument.fdoc"/>
</FixedDocumentSequence>

<FixedDocument xmlns="http://schemas.microsoft.com/xps/2005/06">
  <PageContent Source="Pages/1.fpage" Width="816" Height="1056"/>
</FixedDocument>

A page is a FixedPage element. Units are 1/96 inch: a Letter page is 816 x 1056, A4 is about 793.7 x 1122.5. The origin is the top-left corner.

XML
<FixedPage xmlns="http://schemas.microsoft.com/xps/2005/06"
           Width="816" Height="1056" xml:lang="en-US">
  <Path Data="M 96,96 L 720,96 720,200 96,200 Z" Fill="#FF3366CC"/>
  <Glyphs FontUri="/Documents/1/Resources/Fonts/0A1B2C3D-4E5F-6071-8293-A4B5C6D7E8F9.odttf"
          FontRenderingEmSize="24" OriginX="96" OriginY="260"
          Fill="#FF000000" UnicodeString="Hello, XPS"/>
  <Canvas RenderTransform="0.5,0,0,0.5,96,300">
    <Path Data="M 0,0 L 400,0 400,300 0,300 Z">
      <Path.Fill>
        <ImageBrush ImageSource="/Documents/1/Resources/Images/1.png"
                    Viewbox="0,0,400,300" ViewboxUnits="Absolute"
                    Viewport="0,0,400,300" ViewportUnits="Absolute"/>
      </Path.Fill>
    </Path>
  </Canvas>
</FixedPage>
Element Purpose
Path vector shape: geometry in Data (SVG-like path syntax) or PathGeometry, with Fill, Stroke, Opacity, Clip
Glyphs a run of text in one font: UnicodeString for the text, Indices for exact glyph IDs and advances
Canvas group with a shared transform, clip, opacity or mask
brushes SolidColorBrush, LinearGradientBrush, RadialGradientBrush, ImageBrush, VisualBrush

Colors are #AARRGGBB (alpha first) or scRGB/ICC colors. XPS supports transparency everywhere, unlike PostScript.

Fonts and images#

XPS vs OpenXPS#

XPS 1.0 (Microsoft) OpenXPS (ECMA-388)
Extension .xps .oxps
Main namespace http://schemas.microsoft.com/xps/2005/06 http://schemas.openxps.org/oxps/v1.0
Written by Windows Vista/7, .NET System.Windows.Xps Windows 8 and later XPS Document Writer

The page model is the same. The Windows 7 XPS Viewer can’t open .oxps; current viewers (SumatraPDF, MuPDF, libgxps) open both.

Converting XPS#

Shell
# XPS/OXPS to PDF
mutool convert -o out.pdf in.oxps          # MuPDF
gxps -dNOPAUSE -sDEVICE=pdfwrite -sOutputFile=out.pdf in.xps   # GhostXPS
xpstopdf in.xps out.pdf                    # libgxps tools

# XPS pages to PNG at 150 dpi
mutool draw -r 150 -o page-%d.png in.xps

On Windows, printing a PDF or any document to “Microsoft XPS Document Writer” creates an .oxps file; “Microsoft Print to PDF” turns an XPS opened in XPS Viewer into PDF.

Specifications and documentation#

Software that opens XPS files#

SoftwareWindowsmacOSLinuxWebCanNotes
SumatraPDF✓viewfree, open source; opens .xps and .oxps
XPS Viewer✓viewMicrosoft; an optional Windows feature since Windows 10 1803 (Settings > Optional features)
Microsoft XPS Document Writer✓createbuilt-in virtual printer; saves any printout as .oxps
MuPDF✓✓✓view, convertAGPL or commercial; mutool convert to PDF. Also on Android
Okular✓viewfree, open source KDE viewer
Evince✓viewGNOME document viewer, through libgxps
Zathura✓viewwith the MuPDF plugin
GhostXPS✓✓convertXPS interpreter from the Ghostscript family (gxps); AGPL or commercial

Libraries#

Open-source libraries that read, render and write XPS. See all XPS libraries for a comparison.

C/C++libgxps, MuPDF
C#System.Windows.Xps
PythonPyMuPDF
Rustmupdf