MacroPackage: common-graphicsToCDocOverviewCGDocRelNotesIndexPermutedIndex
Allegro CL version 6.2
Moderately revised from 6.1

with-printer

Arguments: (stream-variable &rest printer-args &allow-other-keys) &body body

This macro allows opening a printer stream to query its properties without ejecting any paper from the printer as with-output-to-printer (or open-stream followed by close) does. This may be useful, for example, for implementing a Print Preview dialog, where you must know the available drawing area of a printer before an actual print is done.

(In the past, it has been possible to close a printer stream without ejecting paper from the printer by passing the :abort argument to close as true. It appears that this technique does not work in Windows 2000, however, so that functionality has been deprecated in favor of this new macro, which requires that an application indicate at the outset that a printer stream is not for actual printing.)

with-printer accepts the same arguments as with-output-to-printer, most of which are documented under pop-up-printer-job-dialog. In particular, most applications will probably want to pass the no-dialog-p keyword printer argument as true in order to silently query a printer without showing the Print Job dialog to the user.

It may be desirable to pass certain printing arguments that are to be used later when actually printing, in order to query the printer attributes of interest in that context. Doing this will not change the default values of these argumentns for subsequent printing though.

Here's an example that returns the name of each installed printer along with its resolution and its margin properties that denote the range of stream units within which an application should draw on that printer. The returned values reflect the :landscape orientation that is passed in. (See *default-printer-left-margin* for an explanation of how Common Graphics sets up the initial margin properties of a printer.)

(mapcar #'(lambda (name)
            (with-printer (out :printer-name name
                               :orientation :landscape
                               :no-dialog-p t)
              (list (printer-name out)
                    (stream-units-per-inch out)
                    (left-margin out)(top-margin out)
                    (right-margin out)(bottom-margin out))))
  (printer-names))

Copyright (c) 1998-2002, Franz Inc. Oakland, CA., USA. All rights reserved.
Documentation for Allegro CL version 6.2. This page has had moderate revisions compared to the 6.1 page.
Created 2002.2.26.

ToCDocOverviewCGDocRelNotesIndexPermutedIndex
Allegro CL version 6.2
Moderately revised from 6.1