capturing the space tree as a png image on a button click

154 views
Skip to first unread message

venkatesh kavuluri

unread,
Nov 14, 2009, 11:20:39 PM11/14/09
to javascript-information...@googlegroups.com
Hi guys,

Is there any straightforward way to capture a the spacetree being currently shown as a PNG image upon a button click! For reporting purposes it will be useful.

Thank you for the suggestions,
Venkatesh

Nico Garcia Belmonte

unread,
Nov 15, 2009, 6:47:11 AM11/15/09
to javascript-information...@googlegroups.com
This can help,

http://stackoverflow.com/questions/923885/capture-html-canvas-as-gif-jpg-png-pdf

You won't be able to save the text within the Spacetree nodes however, since they're html labels on top of the canvas tag.
You could however implement a new node rendering function that does exactly the same as the current node rendering function but also prints with the canvas text api the text in the node instead of using the html labels (you'd use that just when the user wants to print an image from the canvas).

For more info. about that there's ST.Plot.NodeTypes

http://thejit.org/docs/files/Spacetree-js.html#ST.Plot.NodeTypes

(take a look at that section of the code to know how node rendering functions are implemented).

Also the Canvas text API:

https://developer.mozilla.org/en/Drawing_text_using_a_canvas

Hope it helps,
--
I would never die for my beliefs because I might be wrong.

Bertrand Russell

venkatesh kavuluri

unread,
Nov 15, 2009, 1:27:46 PM11/15/09
to javascript-information...@googlegroups.com
Hi Nico,

Thank you for the pointers. I will get back to you once I finish implementing the modifications you suggested.

Venkatesh

joe_sm413

unread,
Jun 29, 2012, 11:48:42 AM6/29/12
to javascript-information...@googlegroups.com
Sorry to respond to such an old topic - Was there ever a solution found?

I can open the div of the tree in a new window - but it loses the node colors. I can save the canvas, but it loses the text of the nodes.

joe_sm413

unread,
Jul 20, 2012, 2:47:02 PM7/20/12
to javascript-information...@googlegroups.com
Anyone? I feel like this has to be something that has been dealt with before. 
Reply all
Reply to author
Forward
0 new messages