ClassPackage: cgToCDocOverviewCGDocRelNotesFAQIndexPermutedIndex
Allegro CL version 8.1
Unrevised from 8.0 to 8.1.
8.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-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