What: tkprint (Ian)

 Where: (??? page not found)
 Description: Allows you to print the content of a canvas or text widget
        under Windows without having to do PostScript.
 Updated: 08/1999
 Contact: mailto:[email protected] (Ian) (???)

What: TkPrint 1.1

 Where:       Custom Clients Web Site:
 Description: The TkPrint 1.1 package is an enhanced version of the
        TkPrint extension. The package permits the capture of
        widget windows to local files, and the printing to local printers
        of displayed widget contents using the native Windows
        printing facilities.
 Updated:     05/2005
 Contact:     [email protected]

 What: Variety of Windows extensions (Findleton)
 Description: Currently available are extensions that support DDE (v 203),
        Winhelp (2.0), printing (tkprint 1.17), frame animation, BMP creation,
        and an extension that does "everything" that DDEML does, including
        being able to write DDEML servers entirely in Tcl.
        Also mentioned having written an IRC client extension.
 Updated: 03/2004
 Contact: [Iain B. Findleton] mailto:[email protected]

Victor Wagner reports that tkPrint is closed-source and "cannot work with non-latin1 symbols", in apparent contrast to Schwartz's GDI and Print extensions mentioned below.

Victor, to which tkPrint do you refer?

Other printing related extensions include:

 What: Tcl Extensions by Michael Schwartz
 Description: This page contains pointers to a number of Tcl extensions,
        including a Tk that uses Curses,  
        GD (Image file rendering based on the Tom Boutell's gd library
        - supports PNG and GIF) - version,
        GDI (Graphics device drawing similar to Tk canvas, but for Windows)
        - version,
        HDC (Name/address manipulations) - version,
        WMF (Windows metafile context for copying to clipboard)
        - version,
        Printer (printer contexts, providing invocation of common printer
        dialogs and exposes the device context for supporting interaction
        with other platform specific drawing primitives - Windows and Unix) -
        Profile (.INI file manipulations - Windows and Unix) - version,
        Signal (simple signal processing - Unix) - version
 Updated: 07/2007
 Contact: mailto:[email protected]

 What: TclPrint
 Description: Small Tcl extension to provide the framework for printing
        on the Macintosh and Windows platoform.  Provides hooks to native
        printing dialogs and support for the overall printing loop.
        Does *NOT* support a way to specify what goes on the page.  Work
        with contact to develop the code.
 Updated: 10/1997
 Contact: mailto:[email protected]

As far as I know both, Tkprint AND Printer.dll by M.Schwartz have severe problems printing characters above code 255. The Documentation of the GDI Extension, that's necessary to be used with printer.dll says: "LIMITATIONS: Assumes 256 characters per font."[L1 ] Tkprint on the other hand claims to be compatible with utf-8, but when trying to print it also fails to render those correctly. "The code that handles the printing of text widgets has been modified to support UTF-8 character encoding."[L2 ] So currently I have no Idea how printing unicode text can be done with tcl/tk and Windows. Patrick Heck

The gdi package now does support UTF-8 as of version Thank you to ElectronicFarm, and Carlos Tasada for reporting this problem to me so it could be fixed. Michael I. Schwartz

KPV 2008-06-18: I've been using Michael Schwartz's printer/gdi extensions for a while now and find they work great. The one problem I had was trying to figure out the actual page size and so I had just hard coded those values. But recently I changed printer and the page size changed, so I decided to dig into the source to figure out how to compute the printer devices page size. Once you realize the units are 1000 of an inch, it's pretty easy.

proc GetPrinterPageSize {} {
    package require printer
    printer dialog select                       ;# Allow user to choose printer
    set val [printer attr -get "page*dimensions"]
    foreach {pw ph} [lindex $val 0 1] break
    set val [printer attr -get "page*minimum*margins"]
    foreach {lm tm rm bm} [lindex $val 0 1] break
    set val [printer attr -get "pixels*per*inch"]
    foreach {ppiW ppiH} [lindex $val 0 1] break

    printer close
    # NB. we're ignoring "page margin" attribute

    set width [expr {($pw - $lm - $rm) * $ppiW / 1000}]
    set height [expr {($ph - $tm - $bm) * $ppiH / 1000}]
    return [list $width $height]

Category Printing - Category Package