XPS to SVG

Nothing you choose here leaves your browser, and nothing is downloaded to make it work. An XPS is a ZIP of XML — the same shape as a DOCX — and the drawing commands inside are all but SVG's already.

…or drop one anywhere on this page.

The one that keeps a page a page.

An XPS page and an SVG describe a drawing the same way — shapes at coordinates, in the same units, with the origin in the same corner — so nothing is scaled, flipped or rounded on the way across. Zoom in as far as you like and the edges stay edges. One SVG comes out per page.

An XPS is Microsoft's answer to PDF, and almost nobody opens one

Windows used to offer Microsoft XPS Document Writer alongside the printers, and a great many people printed to it by accident and were left with a file nothing they own will open. That is usually why somebody is on this page. It is a real format, well specified, and it lost.

.oxps is the same thing under a later name — the standardised version, which Windows 8 onwards writes by default. Both are read here, and the difference does not matter for anything this page does.

The coordinates come across untouched

An XPS page is measured in ninety-sixths of an inch, with the origin at the top left and y increasing downward. That is exactly an SVG user unit at the usual 96 DPI, and the corner and direction match too — so a shape at 100, 100 in the document is a shape at 100, 100 in the result. There is no scale factor anywhere in this conversion.

Measured rather than assumed: a page declaring Width="192" is reported by MuPDF as 144 points across. 144 points is two inches, and two inches is 192 ninety-sixths.

The colours put the alpha first

XPS writes a colour as #AARRGGBB. CSS and SVG write it as #RRGGBBAA. The transparency is at the opposite end, and copying the eight characters straight across does not fail — it draws the wrong colour.

In the XPS#FF3366CC
Rendered(51, 102, 204) — an opaque blue, measured by rendering it
Read as CSS(255, 51, 102) at 80% — a pink-red

And the fill rule is the other way round

Path data in an XPS may begin with F0 or F1, choosing even-odd or nonzero filling. Two things follow and both bite.

First, that prefix is not a path command. Hand it to an SVG parser and it stops at the F, so the shape does not draw wrongly — it does not draw at all. It has to come off the front and become an attribute.

Second, the defaults disagree. Measured on a square with a square hole in it: with F0 the hole is open, with F1 it is filled, and with no prefix at all it is open. So XPS defaults to even-odd — and SVG defaults to nonzero. Leave the rule off and every hole in every letter, washer and ring quietly fills in. This page writes the rule out on every single path, even where the file agreed with it.

What it will not do

Where to go next