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

with-output-to-printer

Arguments: (stream-var &rest printer-args &key units-per-inch font (cancel-value :cancel) &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-2016, Franz Inc. Oakland, CA., USA. All rights reserved.
This page was not revised from the 8.1 page.
Created 2010.1.21.

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