All Manuals > CAPI User Guide and Reference Manual > 21 CAPI Reference Entries

set-printer-options Function

Summary

Sets various options in the given printer.

Package

capi

Signature

set-printer-options printer &key output-file first-page last-page orientation copies

Arguments
printer
A printer.
output-file
A pathname designator or nil.
first-page
A positive integer or nil.
last-page
A positive integer or nil.
orientation
One of :landscape, :portrait or nil.
copies
A positive integer or nil.
Description

The function set-printer-options allows some printer options for the current job to be set programmatically. Note that the user can change the various printer options in the dialog displayed by print-dialog.

printer should be a printer object returned by current-printer or print-dialog. printer should then be passed to with-print-job to print using the options specified.

The keyword arguments control which options are set. If a keyword is not passed then the option remains unchanged.

Values of output-file are:

nil
Print directly to the device.
t
Print to a file chosen by the user at printing time.
A pathname
Print to the file given by pathname.

Values of first-page are:

:all
Print all pages.
An integer
Print from this page to the page given by last-page.

Values of orientation are:

:landscape
Print in landscape mode.
:portrait
Print in portrait mode.

Values of copies:

An integer
The number of copies to print.
Notes

Printer objects cannot be reused after changing their options or metrics. Call current-printer after set-printer-options to get a new printer object containing the latest settings.

Examples
;; Print two copies to the current printer.
(let ((printer (capi:current-printer)))
  (capi:set-printer-options printer :copies 2)
  (capi:with-print-job (port :printer printer)
    (print-my-document port)))
See also

print-dialog
current-printer
with-print-job
16 Printing from the CAPI—the Hardcopy API


CAPI User Guide and Reference Manual (Macintosh version) - 01 Dec 2021 19:31:27