Using JSignature to return strokes

387 views Asked by At

I'm working on an Outsystems project, which is using a plugin built on JSignature. I was wondering if it was possible to use JSignature to return the strokes on the canvas, i.e. the x and y co-ordinates of the strokes made by the user. If not, is there a way to convert an image in order to obtain the co-ordinates as they would be on a canvas?

1

There are 1 answers

0
setilight On

According to jSignature's documentation, the component supports exporting a signature in a native format, as arrays of (x,y) coordinates, or in SVG format, besides the image format that the OutSystems Forge component uses. The methods to do this are not part of the Signature Forge component, so you'll have call the necessary functions yourself.

If you open the Signature component's code you'll notice that this is how it is initialized:

$(document).ready(function() {
     var " + Replace(jSignature.RuntimeId,":","") + "_signature = new Signature();
     " + Replace(jSignature.RuntimeId,":","") + "_signature.initUI('" + PlaceId + "', '" + ImageInputId + "', " + If(ShowClearLink, "true", "false") + "," + Settings + ");
     $('#" + PlaceId + "').addClass('NoSwipe');
});

This means the screen where the component is used in will have a variable (named using the expression "Replace(jSignature.RuntimeId,":","") + "_signature") that you can use to invoke the getData function and obtain the information you want.