Signature Applet


Copyright 2002 Lawrence Goetz

I have gotten this to work on Netscape 4.x, IE 4.x, and IE 5.x. It does not work on the 3.x series of the browsers.

This is a client/server application. The client part is a Java applet. The server part is generally a CGI script. I have written a server Perl script to take a signature and email it as a JPEG image. You are welcomed to write your own client code, however should you wish to order the Perl script it is only $25. The signature applet sends it's output as X,Y plot points for the lines.

You should test the script first before making ordering the script. Look at the requirements.

Applet tag:

<applet code=sign.class name=sign width= height= name="sign">

</applet>

You'll need up upload both sign.class and scanvas.class.

Specify the size of the applet.

In your form have a hidden item called signature.

<INPUT TYPE=hidden NAME="signature" value="">

In your form tag have something for onSubmit.

onSubmit="if (sign) { signature.value=sign.signature();}"

You can also have a clear button by adding to your form:

<input type=button value="Clear" onclick="if (sign) { sign.clear();}">

You also have the specify the size of the image:

<INPUT TYPE=hidden NAME="width" value="">

<INPUT TYPE=hidden NAME="height" value="">

Such as:

<INPUT TYPE=hidden NAME="width" value="500">

<INPUT TYPE=hidden NAME="height" value="300">

You have the option of specifying a subject for the email and the filename of the image:

<INPUT TYPE=hidden NAME="subject" value="">

<INPUT TYPE=hidden NAME="filename" value="">

Such as:

<INPUT TYPE=hidden NAME="subject" value="Signature Test">

<INPUT TYPE=hidden NAME="filename" value="testsig.jpg">

If you prefer, you may have the address that receives the signature has a hidden field:

<INPUT TYPE=hidden NAME="mailto" value="">

Such as:

<INPUT TYPE=hidden NAME="mailto" value="you@you.com">

Otherwise have a field in which the user can set the address to be sent to.

You can also have a field to send the user to an address when the form is done:

<INPUT TYPE=hidden NAME="done" value="http://yoursite.com/thanks.html">

When someone presses the submit button, a CGI program gets the data from your form in field signature with the code numbers from the signature.

Test Form

Upload the above form and Java class files to your server, along with the test Perl script, to see if it will work on your server. If it works you'll get a blank image sent via email. That means all the library files work properly.

On my web site there is a form what will send you back a JPG image of the drawing made.

Perl Script

Included here is a compatibility test for your server. Use it to test that my Perl script and use of Perl library files work on your server. You must test out the Perl script on your site before placing your order. Sorry there are no refunds if the script does not work on your site. That is why you need to test the compatibility script first. As a precaution, the ordering URL is generated after the Perl script finishes running to prove to you that it works.

None Perl Example

If you can't use perl library files, you can at least get the plot points from the script and display the image that way. The applet will take a parameter called signature with the value of the signature to redisplay. <PARAM name="signature" value="">
View the source on the example page to see what is done.

When someone presses the submit button, the program getting the data from your form will have the field signature with the code numbers from the signature. You can regenerate the signature using the decoding program of the applet, or by saving an html file with the signature code as the value for the signature parameter. The actual numbers are plotting points for lines. Each 4 numbers represent (x1, y1) , (x2, y2) for a line.

Decode

If the applet on your site is larger than the decoding applet, you will need to adjust the size of the decoding applet to match size of the applet you placed on your site. If you have no signature code, try entering a series of line points.
Such as a simple line: 0 0 100 100
A box:
10 10 100 10 100 10 100 100 100 100 10 100 10 100 10 10

Feedback

Visit my web site for other software

Thank you,

Lawrence Goetz