Saturday, August 11, 2012

XPS Document Bits and Pieces

This is a bit of a stream of consciousness note; I want to get down important definitions/descriptions of the document specification.

ECMA Document defining an XPS document (a PDF file, of course! *giggle*)
http://www.ecma-international.org/activities/XML%20Paper%20Specification/XPS%20Standard.pdf

Unit of measurement withing an XPS document is ST_GEOne. Otherwise/elsewhere known as an XPS unit.
Finding a definition of this unit was challenging!  Turns out it is 1/96th of an inch.  Yay for non-metric measurement systems!

<SideBar>I live in a non-US country, so I live in metric/ISO standard land. (what is with the US and their inability to get  with the metric program?!).  Do you know an inch is defined as exactly 25.4 mm?  So the stupid old measurement system of inches is actually defined in metric units.</SideBar>

I will typically use in my documents A4 or A5 text, so in various measurement units:
A4297 x 210 mm11.7 x 8.3 in 1122.5 x 793.7 xps units 
A5210 x 148 mm8.3 x 5.8 in 793.7 x 559.4 xps units

When the FixedDocument is defined, you can set the indicated Width and Height of the pages, but these can be overruled in the individual pages of the FixedDocument.  The Width and Height also define whether the page is Portrait or Landscape, so you want to set the printer correctly to avoid clipping.

A FixedPage has the attributes of
Required: Width, Height (physical media size)
Optional: ContentBox (where the content resides) this has 4 values: ContentOriginX, ContentOriginY, ContentWidth, ContentHeight
Optional: BleedBox (BleedOriginX, BleedOriginY, BleedWidth, BleedHeight)
Required: xml:lang eg "en-US", "en-AU"
Optional: Name (used if want to reference the FixedPage elsewhere by name)

Anyway, time to start coding my own XPS creation engine...






No comments:

Post a Comment