14.7.1 Establishing a page transform

The
with-page-transform
macro can be used to establish a page transform that maps a rectangular region of the document to the whole page being printed. Any number of invocations of
with-page-transform
may occur during the printing of a page. For instance, it may be convenient to use a different page transform when printing headers and footers to the page from that used when printing the main body of the page.

A helper function,
get-page-area
, is provided to simplify the calculation of suitable rectangles for use with
with-page-transform
. It calculates the width and height of the rectangle in the user's coordinate space that correspond to one printable page, based on the logical resolution of the user's coordinate space in dpi.

For more specific control over the page transform, the printer metrics can be queried using
get-printer-metrics
and the various printer-metrics accessors such as
printer-metrics-height
.