jprint.tcl
The
jprint.tcl library is distributed as part of the
jstools package. It lets you print text or PostScript to a printer,
providing the user with a confirmation panel that shows how the
text will be printed. It works in conjunction with
the
jstools Global Preferences panel to let the user select a printer (or output file) and method
of printing.
This document describes
jprint.tcl version 2001.02.10.
Usage
Accessing the Library
In order to use the
jprint.tcl library, it (and any other libraries it depends on) must be
in your Tcl
auto_path, described in
tclvars(n). Information about how to arrange that, and other conventions
common to
the
jstools libraries, is in
the
Usage section
of
The jstools Libraries.
Author
Jay Sekora
js@aq.org
http://www.aq.org/~js/
Copyright
The library is copyright © 1992-2001 by Jay Sekora, but may be
freely redistributed under the conditions at the top of the file.
Procedure
::jstools::print - print text
::jstools::print_ps - print PostScript
::jstools::print
Usage
::jstools::print
[options]
Options
-title
title (default
Print)
-data
text (default
{} - not really optional)
Example
::jstools::print -data [.text get 1.0 end]
Description
This prodedure creates a popup confirmation window showing the
user how
data would be printed, given the current printing preferences as
set in
the
jstools Global Preferences panel, and asking the user whether to print. If the user clicks
OK,
data is sent to the appropriate printing command or output file.
If
title is specified, it will be the title of the panel, for use by
the window manager.
If the global variable
J_PREFS(autoposition) is true, the panel will be (approximately) centred on the screen
by the
j:dialogue procedure (in
jtkutils.tcl).
Note
The value of
title is not automatically localised; you should convert it to
its localised form using the procedures in
jldb.tcl (the
jldb package) before calling
::jstools::print.
::jstools::print_ps
Usage
::jstools::print
[options]
Options
-title
title (default
Print PostScript)
-data
text (default
{} - not really optional)
Example
::jstools::print_ps -data [.canvas postscript]
Description
This prodedure is identical to
::jstools::print_ps except that (1) its title and prompt mention that the data
to be printed is PostScript, and (2) it throws an error if
data does not start with `%!', since that will confuse many PostScript interpreters
Future Directions
- A future version of this library will provide a user interface
to the printing preferences directly on the confirmation panel.