Forum Discussion

royd's avatar
royd
Regular Contributor
8 years ago

How to simulate signature on html canvas

Hi all,   I’m using TestComplete version 12 and Jscript. Is possible to make a mark on a HTML canvas (IE11)?  I am attempting to simulate signature using mouse. I should point out, I’m new to scrip...
  • tristaanogre's avatar
    8 years ago

    I think you should be able to just use a "drag" call.  So, if your canvas is called canvasSignature, to draw a mark on the canvas, just do

     

    canvasSignature(-1, -1, 100, 100)

    This will click in the center of the object and drag the mouse 100 pixels down and 100 pixels right.  That should draw a line.

    Now, if you want to ACTUALLY do a signature... yeah, that could get trickey as you would need to combine a lot of different drag calls.  But if you just want to make a mark, "Drag" should do what you want.