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

NextPrevUpTopContentsIndex

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

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.

The printer argument should be a printer object returned by current-printer or print-dialog. This 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.

Example
;; 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
Printing from the CAPI—the Hardcopy API


CAPI User Guide and Reference Manual (Windows version) - 3 Aug 2017

NextPrevUpTopContentsIndex