Use this page to accumulate pointers to various issues tcl has with printing: * [Printing a canvas under Windows] * [TkPrint] * [Printing text files under Windows] ---- Question: How do I print the contents of a text widget that contains various unicode, mixed fonts, etc. ? What about a text widget with embedded images? ---- Also, see [LV]'s pithy introduction to the complexity of "printing" [http://groups.google.com/groups?hl=en&frame=right&th=915e777177ad4ab7]. In summary: printing means many things - to some, it means generating a report, like perl's format type command . To others, it means the equivalent of a screen shot of a particular window. To others, it means produce on paper the equivalent of what is on the screen, only scaled to the size on the paper. Or even to write, directly to a printer, the reports. And there may be other interpretations as well. Different printers can expect data to be in ASCII, PostScript, as well as a variety of custom (and sometimes proprietary) languages. ---- Windows printer information with no particular connection to Tcl; package require registry registry keys HKEY_CURRENT_USER\\Printers\\Connections or package require printer printer list "printer" here is [Michael I. Schwartz]'s. ---- [[Discuss use of [Xbit] to help with printing. Example: the following script will create a Tk photo from a GUI window: # create ram image from a GUI window rimage window ramimg [rimage window $guiPath frame] # create a gimg image from a ram image set img [image create gimg -file ramimg] # create a Tk Photo named gui.photo $img dump gui.photo TKPHOTO 8 1 # create a canvas image item with the gui.photo and print it .....]] ---- [RS] (ab)uses IE as printer driver for multilingual documents by generating a temporary HTML file (see [taiku goes multilingual]). ---- [KBK]'s quick-and-dirty Unix-side Tcl-ignorant [xwd]-enabled screen-dump-to-printer: exec xwd -id [winfo id .] | xwdtopnm | ppmtops | lpr During summer 2002, KBK says on comp.lang.tcl: I'd love to have native printing on Windows, and would even devote a fair amount of time to it. The difficulty, though, is in coming up with a specification of just what "native printing" is - one that meets the requirements of a fair number of applications. Generally speaking, page layout is vastly different from screen layout, so what's desired is NOT simply a "print screen" function. Printing a canvas to PostScript comes close for drawing applications, but is totally wrong for a text editor, and a "print" function for the text widget is out of reach unless we can define the pagination mechanism. It's a hard problem to get started on. The mechanics aren't horribly difficult -- in fact, the hard part from the mechanical standpoint would be a backport of the functionality to Unix. Instead, the really thorny issue is defining what's wanted. ---- [LV] It seems like a way to begin would be to brainstorm on the requirements and come to some agreement on the interfaces needed, then take on some portion of functionality that is desired, implementing it, then moving on to the next piece. As mentioned above, printing means many different things to different people. What if we started with a list of what functionality is needed, along with what techniques exist now for providing that functionality? Types of printing that a Tcl or Tk developer has identified as a need. 1. print simple ASCII text 1. print simple ASCII text formatted into various reports 1. print text in various fonts and colors as displayed in a tk widget 1. print a scaled representation of one or more toplevel windows There are currently several techniques for accomplishing ''printing'' supported by Tcl/Tk. 1. tcl has the ability to [open] a device and write plain ASCII characters to it. This provides the crude ability for a text editor to get a file's contents printed. [KPV] under Windows see [Printing text files under Windows] 1. [TclVSrpt] provides some report creation support 1. I don't know of anything that provides support for printing text in appropriate fonts and colors as displayed in a tk widget. 1. [tk]'s [canvas] has the ability to generate a [PostScript] file that reflects an image of some portion of the canvas's contents. In addition, [tkprint] has the ability on [windows] to perform some degree of printing. Now, as people read over this, perhaps they will add the names of other extensions which provide some degree of print support. ---- A Windows way to have a '''printer properties dialog''' come up: RUNDLL32 PRINTUI.DLL,PrintUIEntry /p /n\\machine\printer ---- [Category Concept] | [Category Printing]