ClassPackage: cgToCDocOverviewCGDocRelNotesFAQIndexPermutedIndex
Allegro CL version 9.0
Unrevised from 8.2 to 9.0.
8.2 version

printer

The class of printer objects. Open a printer with open-stream (not make-instance). For example, this form, if run, sets some values and pops up a printer job dialog for getting more instructions from the user:

(open-stream 'printer nil nil
             :output :units-per-inch 100
             :font (make-font-ex nil :arial 48)) 

The printer-specific arguments to open-stream are documented under pop-up-printer-job-dialog. Do not call that function directly, though, because it is called internally when you open a printer stream. To show the Page Setup dialog, which is independent of any particular print job, call pop-up-printer-setup-dialog at any time.

A higher-level alternative to open-stream is with-output-to-printer. This macro ensures that the printer stream gets closed after executing the macro body, and avoids executing the macro body at all if the user cancels the print job dialog. It also provides additional arguments for setting up the resolution and initial font of the printed output.

You can draw on a printer stream just as you would on a window, calling functions such as draw-line and draw-string-in-box. The pixel resolution of a laser printer is typically much finer than on a monitor, though, so first call stream-units-per-inch to find the resolution and then adjust your drawing code to it, or call (setf stream-units-per-inch) to adjust the stream's resolution to your preferred drawing coordinates. Call left-margin, top-margin, right-margin, and bottom-margin to find the coordinates within which you should draw on the current page, and call new-page to advance to the next printed page.

To find out attributes of a printer without actually printing anything, use with-printer.

GTK Note

Printing (hardcopy) is not implemented on the GTK platform at this time. Opening a printer stream will simply invoke the *gtk-compatibility-warning-action*.


Copyright (c) 1998-2019, Franz Inc. Oakland, CA., USA. All rights reserved.
This page was not revised from the 8.2 page.
Created 2012.5.30.

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