Home > Archive > Tcl > June 2007 > TkHTML3 and printing?
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
TkHTML3 and printing?
|
|
| skuhagen@web.de 2007-06-05, 4:14 am |
| Hello
I'm currently implementing a help-browser using TkHTML3. One feature
should be to print the current help-page. I can't figure out, if it's
possible to export the rendered contents of hv3 (the megawidget for
rendering HTML in TkHTML3). Is it possible to export the rendered
contents to Postscript or to something else like it can be done in
Canvas? If not, does anybody know of a Tcl/Tk-only way of exporting a
HTML-Document to Postscript or something else?
TIA, regards
Stephan
| |
| MartinLemburg@UGS 2007-06-05, 7:10 pm |
| Hello Stephan,
I use still TkHTML2, but perhabs the way to go is similar.
1. I extract the text contents from the TkHTML2 widget
2. I push the text contents into a temporary text widget
3. I use the binary tkPrint extension on MS Windows to print the text
widget contents using the command "Print"
4. I destroy the text widget
The tkPrint extension is able to print a canvas, but I don't know if
the new TkHTML3 provides a kind of canvas creation from its contents,
or if it is able to emulate a canvas widget.
Best regards,
Martin
On Jun 5, 8:14 am, skuha...@web.de wrote:
> Hello
>
> I'm currently implementing a help-browser using TkHTML3. One feature
> should be to print the current help-page. I can't figure out, if it's
> possible to export the rendered contents of hv3 (the megawidget for
> rendering HTML in TkHTML3). Is it possible to export the rendered
> contents to Postscript or to something else like it can be done in
> Canvas? If not, does anybody know of a Tcl/Tk-only way of exporting a
> HTML-Document to Postscript or something else?
>
> TIA, regards
> Stephan
| |
| skuhagen@web.de 2007-06-05, 7:10 pm |
| Hello
Thanks for the hints, but:
> 1. I extract the text contents from the TkHTML2 widget
I can do this, but I need the full document, including images and
formatting, not just plain text.
> 2. I push the text contents into a temporary text widget
> 3. I use the binary tkPrint extension on MS Windows to print the text
> widget contents using the command "Print"
I'm on Linux...
> 4. I destroy the text widget
>
> The tkPrint extension is able to print a canvas, but I don't know if
> the new TkHTML3 provides a kind of canvas creation from its contents,
> or if it is able to emulate a canvas widget.
That's what I was hoping for... But the documentation of TkHTML3 is
not very usefull and its not in sync with the source, I think - or
maybe I simply do not understand it...
Regards
Stephan
| |
| Goeran Hanke 2007-06-10, 10:08 pm |
| Hello,
> Canvas? If not, does anybody know of a Tcl/Tk-only way of exporting a
> HTML-Document to Postscript or something else?
Only "something else"....
You have three options:
1) Printing? What's this?
Let the user configure a program that can print html.
2) Do the above job for the user.
Use html2ps on Unix or 'rundll32.exe mshtml.dll,PrintHTML "%1"' on Window=
s.
3) Implement a -postscript option for the widgets
you have to render the contents on your own. This leads to a=20
reimplementation of html2ps in Tcl.
Cheers, G=F6ran
--=20
string map { DOT . AT @ } goeranDOThankeATgmxDOTde
| |
| skuhagen@web.de 2007-06-11, 8:08 am |
| > You have three options:
> 1) Printing? What's this?
> Let the user configure a program that can print html.
An option is something, you can choose... But I like that one, too.
> 2) Do the above job for the user.
> Use html2ps on Unix or 'rundll32.exe mshtml.dll,PrintHTML "%1"' on Windows.
That won't work in the very restricted target environment.
> 3) Implement a -postscript option for the widgets
> you have to render the contents on your own. This leads to a
> reimplementation of html2ps in Tcl.
That would be too much work, since I had one w to implement the
full help browser...
The solution was to use the image command of tkhtml. Its a little bit
slow, and the results don't look very good, but after getting the
image, it can be exported to postscript via canvas, which works fine.
Thanks for the suggestions anyway.
Stephan
|
|
|
|
|