From: Mats B. <ma...@pr...> - 2005-02-05 11:19:52
|
The MacCarbonPrint is pretty much an experiment, and a "help yourself" project. Not much tested which is indicated by the low version number. Support for text widgets is missing. It is mainly a canvas printing package. The main drawing of the canvas had to be rewritten to be able to draw in the printers graphics device. If you look at the sources it is pretty much code that is taken more or less directly from the tk canvas and modified. Yes, I'm aware of that this causes a maintenance issue, but I see no other way. Doing the similar thing for the text widget requires a lot of work... An alternative is to use the existing printing canvas commands and mimic the text widget from tcl scripts. Also much work with line breaks etc. Anyway, apart from this it seems that the "-documentformat pdf" is wrong. >From the docs it says: " maccarbonprint::getdocumentformats Returns a list of the the spool file formats that can be generated for the specified printing session. Typically application/pdf , and may also include postscript if supported. " this, the mime type "application/pdf". An alternative for printing canvases would be to save it as postscript and use "maccarbonprint::postscript printObject psdata" but that is completely untested since I don't have access to any ps printer for testing. You could perhaps try this using pure text. Hope this helps, Mats Kevin Walzer wrote: > > I'm trying to integrate the MacCarbonPrint package into my VuMan > application so I don't have to use lpr, but I'm running into problems. > The way VuMan works is by writing man output to a temporary HTML file, > then loading the file into the html viewer. The variable for the file > is /tmp/.$manpage.html. > > When I run the print routine, it brings up the standard Mac printing > box correctly, but then prnting crashes: I get the message "the print > session token is illegal". > > My code is below. Any help debugging this is appreciated. Also, I'm > thinking about shifting over to using the basic Tk text widget for my > printing input: would the same printing procedures apply? Thanks. > > set res [::maccarbonprint::print] > if {[llength $res] > 0} { > #set > printObj [lindex $res 1] > set printObj "/tmp/.$manpage.html" > > ::maccarbonprint::opendoc $printObj 1 1 -documentformat pdf > set > win [::maccarbonprint::openpage $printObj] > > # Drawing. > $win > create image 320 40 -anchor nw -image $anImage > ... > > # Close > down. > ::maccarbonprint::closepage $printObj > > ::maccarbonprint::closedoc $printObj > > Looking more closely at the documentation, it seems that > MacCarbonPrint is more suited for printing canvas widget output than > anything else. For text--HTML or plain--does it really offer an > advantage over lpr, apart from the obvious one of using the native > print dialogs? lpr is very configurable for basic text, and works > well: the main issue with it is that some users of VuMan have > complained about not having native printing. |