Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Up/down Scaling singature data #57

Open
vjegatheesh opened this Issue · 1 comment

2 participants

@vjegatheesh

Hi, I have a requirement where in the signature pad is 440x120. This seems to be little small while drawing for the new users who is not accustomed to stylus pen. So on clicking edit button it shows a 880x240 canvas for getting he signature. On closing it show the 1/2x of the original signature which is also saved on the db for png generation to include in a PDF.

I wrote two js functions. Maybe it can be merged as one function in API as something like scaleSign((string)jsonstr, (float)scale); Perhaps with some anti-aliasing code?

Thanks.
-Jega

function sign2x(signStr) {
var newsign = {};
var jSig = JSON.parse(signStr);
for (var i in jSig) {
newsign[i] = {};
for (var j in jSig[i]){
newsign[i][j] = jSig[i][j]*2;
}
}
return JSON.stringify(newsign);
}

function sign_half_x(signStr) {
    var newsign = {};
    var jSig = JSON.parse(signStr);
    for (var i in jSig) {
        newsign[i] = {};
        for (var j in jSig[i]){
            newsign[i][j] = parseInt(jSig[i][j]/2);
        }
    }
    return JSON.stringify(newsign);
}
@DaveSanders

+1 - this would be nice to have. Until then, thanks for the code snippet!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.