Updated 2012-09-09 14:57:00 by RLE

MacCarbonPrint is the Mac OS X incarnation of TclBitPrint.

Are there any examples of how this would work? For example:
   pack [text .t]
   .t insert end "One line\ntwo lines\nthree lines"

How can I now use MacCarbonPrint to print out this widget?

Kevin Walzer March 8, 2007: Printing from the text widget in MacCarbonPrint doesn't work very well: by default it only prints one page. I implemented a higher-level command that works around the limitations of the text widget by creating an invisible canvas (canvas printing works well from MacCarbonPrint). This has been submitted to the MacCarbonPrint developer, Mats Bengtsson, and should be in CVS.

The command is ::maccarbonprint::easytextprint and, rewriting the above snippet to use the new command, would work like this:
    pack [text .t]
   .t insert end "One line\ntwo lines\nthree lines"

   set res [eval {::maccarbonprint::print}]
      if {$res == ""} {
            return
        }
   set printObj [lindex $res 1]

   ::maccarbonprint::easytextprint .t $printObj

::maccarbonprint::easytextprint works by retrieving the text from the text widget, dumping the text to a canvas that is scaled to letter size (the canvas itself is not drawn on screen), configuring the canvas font to match the text widget font, then sending that output to the printer via the native Mac printing dialog.