MacroPackage: cgToCDocOverviewCGDocRelNotesFAQIndexPermutedIndex
Allegro CL version 9.0
Object described on page has changed in 9.0.
8.2 version

with-output-to-printer

Arguments: (stream-var &rest printer-args &key units-per-inch font (cancel-value :cancel) (printer-class (quote printer)) &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). If printer-class is specified, it should be the name of the printer stream class to be instantiated, which should always be a subclass of the cg:printer class (or that class itself).

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-2012, Franz Inc. Oakland, CA., USA. All rights reserved.
Documentation for Allegro CL version 9.0. The object described on this page has been modified in the 9.0 release; see the Release Notes.
Created 2010.1.21.

ToCDocOverviewCGDocRelNotesFAQIndexPermutedIndex
Allegro CL version 9.0
Object described on page has changed in 9.0.
8.2 version