B510
Posts: 0
Joined: Wed Jun 04, 2014 2:17 pm

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

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

Yurii Orishchuk
Posts: 0
Joined: Fri Feb 14, 2014 8:20 am

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

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.

Wilson W
Posts: 0
Joined: Thu Dec 18, 2014 4:15 am

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

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

Evgene Karachevtsev
Posts: 12
Joined: Mon Apr 28, 2014 1:12 pm

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

Hello Wilson,

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

Return to “Issues”