MacroPackage: cgToCDocOverviewCGDocRelNotesFAQIndexPermutedIndex
Allegro CL version 8.1
Unrevised from 8.0 to 8.1.
8.0 version

with-output-to-printer

Arguments: (stream-var &rest printer-args &key units-per-inch font cancel-value &allow-other-keys) &body body

Executes body with stream-var bound to a newly-opened printer stream. The printer-args parameter allows any initargs that would be passed to open-stream for a printer to be passed to this macro. In addition, if units-per-inch is specified true, then the stream-units-per-inch of the printer stream is set to this value before executing body. If a font is passed, then the font of the printer stream is set to this font before executing body (just after the stream-units-per-inch is set, if this is also done).

When the printer stream is opened, the end user is presented with the printer job dialog as usual (unless the :no-dialog-p printer-arg is passed as true). If the user cancels from this dialog, then cancel-value is returned from the with-output-to-printer form.

Otherwise the values returned by the last form in body are returned. An unwind-protect ensures that the printer stream always gets closed.

The following example does the following:

  1. opens a printer stream,
  2. sets its stream-units-per-inch to 100 (which scales it approximately the same as a video monitor),
  3. sets its font to be a large arial font which is 48 of these stream units tall,
  4. prints "A Large String" on the printer stream,
  5. closes the printer stream (which ejects the output).
> (with-output-to-printer (p :units-per-inch 100
			     :font (make-font-ex nil :arial 48))
     (print "A Large String" p))[returns] "A Large String"

See also with-printer.


Copyright (c) 1998-2009, Franz Inc. Oakland, CA., USA. All rights reserved.
Documentation for Allegro CL version 8.1. This page was not revised from the 8.0 page.
Created 2009.7.29.

ToCDocOverviewCGDocRelNotesFAQIndexPermutedIndex
Allegro CL version 8.1
Unrevised from 8.0 to 8.1.
8.0 version