How to get the data from HTML Canvas

Hi all,
I am developing a web application using Vaadin 7 and I have to get the signature of the user .
I am trying to draw on a canvas using mouse and get that image as signature.
I have been trying the following
https://vaadin.com/directory#addon/canvas
https://vaadin.com/directory#addon/collabsketch-add-on:vaadin
but I am not able to get the drawn signature (as image or as any other output).
Anybody got any Idea on this???..
It would be a great help for me.

Hi Anil
I have the same problem…
I want to save my canvas as image to a specific folder of my application.
How can I do this ?
Anyone know this…??

Hey guys,

Sorry that I couldn’t be of more help, but perhaps this GWT widget might help? GWT’s Canvas:
http://www.gwtproject.org/javadoc/latest/com/google/gwt/canvas/client/Canvas.html
.

I think the method
toDataUrl
does what you want. Example, Image img = new Image(canvas.toDataUrl().

Thanks Joacim Päivärinne for your response.
How can I use this gwt canvas in my Vaadin 7 application?

I’d probably look at how Henri made his add-on and go from there;
https://github.com/hezamu/vaadincanvas
.

Ever figure out how to save a canvas image to the server?

Thx.

You’ll have to extend the original Canvas add-on so that you can use the
toDataURL
from the GWT Canvas implementation. Something along these lines, String dataURL = getWidget().toDataUrl(). Maybe register an RPC and call it at every postLayout().