LispWorks CAPI User Guide > 14 Printing from the CAPI--the Hardcopy API > 14.7 Printing a page


14.7.1 Establishing a page transform

The with-page-transform macro can be used to establish a page transform which controls scaling by mapping a rectangular region of the document to the printable area of the page. By specifying a large rectangle, you can get finer granularity in the drawing. 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 .

Margins and the printable area can be set using set-printer-metrics .

There is an example in examples/capi/printing/fit-to-page.lisp .

LispWorks CAPI User Guide (Unix version) - 22 Dec 2009