ClassPackage: cgToCDocOverviewCGDocRelNotesFAQIndexPermutedIndex
Allegro CL version 10.1
Unrevised from 10.0 to 10.1.
10.0 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-2022, Franz Inc. Lafayette, CA., USA. All rights reserved.
This page was not revised from the 10.0 page.
Created 2019.8.20.

ToCDocOverviewCGDocRelNotesFAQIndexPermutedIndex
Allegro CL version 10.1
Unrevised from 10.0 to 10.1.
10.0 version