-1

Wondering what I need to do with this data below?

I'm not sure what to do with it...

After capturing a signature from this form

     <form method="post" action="signed.cfm">

     <div class="sigPad" id="smoothed" style="width:404px;">
     <h2>Bezier Curves (constant pen width)</h2>
     <ul class="sigNav">
     <li class="drawIt"><a href="#draw-it" >SIGN</a></li>
     <li class="clearButton"><a href="#clear">Clear</a></li>
     </ul>
     <div class="sig sigWrapper" style="height:auto;">
     <div class="typed"></div>
     <canvas class="pad" width="400" height="250"></canvas>
     <input type="hidden" name="sigstr" class="output">
     </div>
     </div>

     <button type="submit">Sign</button> 
     </form>

Signature Done - this is what is returned...

[{"lx":123,"ly":99,"mx":123,"my":98},{"lx":123,"ly":98,"mx":123,"my":99},{"lx":123,"ly":99,"mx":123,"my":98},{"lx":123,"ly":100,"mx":123,"my":99},{"lx":123,"ly":103,"mx":123,"my":100},{"lx":124,"ly":105,"mx":123,"my":103},{"lx":124,"ly":107,"mx":124,"my":105},{"lx":126,"ly":109,"mx":124,"my":107},{"lx":128,"ly":112,"mx":126,"my":109},{"lx":131,"ly":115,"mx":128,"my":112},{"lx":133,"ly":117,"mx":131,"my":115},{"lx":136,"ly":120,"mx":133,"my":117},{"lx":139,"ly":123,"mx":136,"my":120},{"lx":141,"ly":125,"mx":139,"my":123},{"lx":143,"ly":126,"mx":141,"my":125},{"lx":146,"ly":128,"mx":143,"my":126},{"lx":149,"ly":131,"mx":146,"my":128},{"lx":151,"ly":133,"mx":149,"my":131},{"lx":154,"ly":134,"mx":151,"my":133},{"lx":157,"ly":136,"mx":154,"my":134},{"lx":159,"ly":137,"mx":157,"my":136},{"lx":161,"ly":138,"mx":159,"my":137},{"lx":162,"ly":140,"mx":161,"my":138},{"lx":164,"ly":141,"mx":162,"my":140},{"lx":165,"ly":144,"mx":164,"my":141},{"lx":166,"ly":145,"mx":165,"my":144},{"lx":167,"ly":146,"mx":166,"my":145},{"lx":168,"ly":147,"mx":167,"my":146},{"lx":168,"ly":148,"mx":168,"my":147},{"lx":167,"ly":148,"mx":168,"my":148},{"lx":166,"ly":148,"mx":167,"my":148},{"lx":165,"ly":148,"mx":166,"my":148},{"lx":164,"ly":147,"mx":165,"my":148},{"lx":163,"ly":147,"mx":164,"my":147},{"lx":163,"ly":144,"mx":163,"my":147},{"lx":163,"ly":141,"mx":163,"my":144},{"lx":168,"ly":134,"mx":163,"my":141},{"lx":175,"ly":124,"mx":168,"my":134},{"lx":185,"ly":115,"mx":175,"my":124},{"lx":197,"ly":105,"mx":185,"my":115}]

http://www.jqueryscript.net/demo/Smooth-Signature-Pad-Plugin-with-jQuery-Html5-Canvas/examples/

Merle_the_Pearl
  • 1,391
  • 3
  • 18
  • 25

1 Answers1

0

I'm the author of the ColdFusion-port of the PHP script that converts the JSON to an image. We've save the JSON data in case we need to generate the signature on-the-fly. In order to convert it to an image, you'll need to return the JSON data to the CF server and pass it to the UDF. It will generate an image that you can then either serve back to the browser or save it as a physical image file.

If you still encounter problems with the UDF, please provide some source code to demonstrate how you are using it.

Here's an extremely generic way of using it.

POST "SignatureJSON" parameter w/JSON data to "/GenerateSig.cfm".

<CFPARAM NAME="Form.SignatureJSON" DEFAULT="">
<CFIF NOT isJSON(Form.SignatureJSON)><CFABORT></CFIF>

<CFSET TheImage = sigJsonToImage(Signature_Pad_JSON_Data)>

<CFIF NOT IsImage(TheImage)>
    Invalid Image<CFABORT>
<CFELSE>
  <!--- Display Image inline --->
  <cfimage action = "writeToBrowser" source="#TheImage#">
  <!--- or save file and serve via IMG tag
     <cfset ImageWrite(TheImage, "c:\signature.png")> --->
</CFIF>
James Moberg
  • 4,360
  • 1
  • 22
  • 21
  • I'll look into - may have found work around with another one on base64 – Merle_the_Pearl Jul 11 '16 at 21:13
  • I find no GenericSig.cfm file in the download files - I can get the data posting to my signed.cfm - but the sigJsonToImage is not defined – Merle_the_Pearl Jul 11 '16 at 21:20
  • Make your own script and name it whatever you want. You can add this code to "signed.cfm" if the data is posted to it. sigJsonToImage() is a User-Defined Function (UDF). Do you have it defined in your code anywhere? You could add the UDF code to your "signed.cfm" script right above where it's called. You can learn more regarding how to write and call UDFs on Adobe's website: http://help.adobe.com/en_US/ColdFusion/9.0/Developing/WSc3ff6d0ea77859461172e0811cbec22c24-7e10.html – James Moberg Jul 11 '16 at 23:04