Page 7 of 7

How to implement canvas based signature (using signature_pad javascript)?

Posted: Tue Apr 28, 2015 8:40 am
by B510

I am following this topic..
I able to draw on the canvas, but no luck to get base64 string:

var canvas = jQuery("signature_pad")];
var c = canvas[0];
var ctx = c.getContext("2d");

//Get base64String.
var base64String = c.toDataURL();
alert(base64String);

what I missed?..

could you please help?

many thanks in advance


How to implement canvas based signature (using signature_pad javascript)?

Posted: Thu Apr 30, 2015 1:53 am
by Yurii Orishchuk

Hi B510,

It seems you use incorrect to your case selector to get canvas element.

For example if you have canvas element with id="signature_pad" you need to use following JS code:

pre

//Here you should use correct jQuery selector to get your canvas element.
var canvas = jQuery("#signature_pad")];
var c = canvas[0];
var ctx = c.getContext("2d");

//Get base64String.
var base64String = c.toDataURL();
alert(base64String);

/pre

Regards.


How to implement canvas based signature (using signature_pad javascript)?

Posted: Thu May 14, 2015 5:53 pm
by Wilson W

Team

Tried using this code and still can not save file to database

B510 or Yuri can you please verify this worked

Thanks much
Wilson


How to implement canvas based signature (using signature_pad javascript)?

Posted: Fri May 15, 2015 10:00 pm
by Evgene Karachevtsev

Hello Wilson,

Could you please clarify do you get any errors in a browser console?