Tuesday, February 19, 2008

Resolution of XPS Documents

The actually printed resolution of images from a Microsoft XPS document can be different depending on the producer of the XPS document. NiXPS wrote an excellent article on how to prevent images from being reduced to 96 dpi in the Word and Powerpoint.

While images can be embedded in the document at resolutions of 220 dpi, Microsoft's "Save as XPS" tool unfortunately creates the page such that images are printed at lower resolutions. Using tools such as QualityLogic's XPS eXaminer application one can look at the details of the document layout (called FixedPage markup in XPS terminology). I find it easier to use this tool rather than unzipping the XPS document and looking at the markup with an XML editor or Microsoft's XamlPad.

QualityLogic XPS Examiner Screenshot 01
Screenshot from XPS eXaminer

One of the first things seen in the markup is that the XPS documents are generated with a canvas render.transform (see below).

QualityLogic XPS Examiner Screenshot 02
Page Markup from XPS Document with the RenderTransform

Without going into the details of the XML syntax, the render transform shown increases the size of the document by 33%.

This scaling apparently is done to compensate for the page unit differences between traditional printing which works in points (1/72") and the native XPS page unit size of 1/96" and allows the glyphs to be defined in point sizes in the XPS document.

While scaling makes it easier to define text in a manner common for printing, the negative side effect is that the image size and resolution are also scaled in the document by one third. Hence an image saved with a resolution of 220 dpi in the actual XPS document is printed at an actual resolution of approximately 165 dpi.

A solution to this issue would be to not apply scaling and define the glyphs sizes at the native XPS resolution. This is a change that would need to be done either by Microsoft to the "Save as XPS" and XPS Document Writer tools or in the future using an XPS preflight application.

No comments: