| Alastair Davies 2007-02-21, 4:10 am |
| Darren New wrote:
> Robert Heller wrote:
>
> It seems strange to me that this is still problematic, given that
> printing on the printer is essentially a matter of asking Windows for
> the "window" on the printer, then drawing the same canvas with the same
> operations in the printer context instead of the screen context. If you
> can draw it on the screen, drawing it on a printer should be pretty
> trivial.
>
> What's the problem that keeps someone who needs this from tackling it?
> Is the X emulation getting in the way or something?
>
Michael Schwartz's [printer] extension comes just close enough to doing
this for many purposes. ( See
http://www.schwartzcomputer.com/tcl...html#printerTbl ) In the
accompanying FAQ, he answers your question as follows:
> 1) Why doesn't the extension simply replace the hDC in the Tk rendering
> code?
> Actually, this is the hardest question to answer. Clearly, it would
> be better, cleaner, and less code to write to do this. This technique
> has the possibility of working on both NT and the Macintosh, though
> it could not be applied to Unix without an X server whose display is
> a printer page.
>
> Arguing against this approach are:
> 1) Many scripts used for system management or background processing
> wish to print, but have no Tk component. Having an extension
> independent of Tk allows these programs to run. In fact, this was a
> requirement of my initial scripts using this extension.
>
> 2) John Ousterhout and other members of his team have expressed the
> desire to replace the Tk canvas with a better abstraction. When that
> happens, it is likely to have a much better printer integration than
> the current version. However, until that is established firmly, a
> printer extension independent of the canvas implementation is
> desirable.
>
> 3) Technically, if you look through the Tk code, you will find that
> it does not support a "flat" model hDC (there are many "windows" to
> manage over the context), and thus it does not lend itself as easily to
> that approach as one might initially think.
I agree that providing a Windows equivalent of the [canvas postscript]
command would address the single biggest lack of Tk at present.
Alastair
|