Signature Applet
Version 2.0
Copyright 1999-2010 Lawrence Goetz

With the Signature Applet, you can allow a visitor to your site to submit their written signature or drawing to your email address. You can select background color, background image, pen color, and pen thickness. There is also the addition of an undo feature, to undo the last step made.

You'll need to upload both sign.class and scanvas.class, as well as the signature script. Of course you will need Perl.

To create images in Perl you need to use gd & gd for Perl.

To email the images, you'll need MIME-Lite

You will need some mailing program such as sendmail. This should be installed on a standard UNIX/Linux machine.

Install the script to your cgi-bin directory with the file permissions set to 755.
chmod 755 signature.cgi

Make sure that the script file has been uploaded as ASCII (to format the lines properly for a UNIX/Linux system). If you are unsure what format you have uploaded it in, do the following command to convert it properly:
dos2unix signature.cgi

In the cgi file set the @referers to include the various ways your domain name may be refered to. Such as with and without www.

For colors you specify them in R,G,B values. Such as white is 255,255,255 and black is 0,0,0. Here is a color chart to help you pick various colors.

Specify a pen thickness of 2 or more. Under 2 forces the size to 2. Too large of a value will look bad. Try not to go over 15. Test and experiment to see what's right for you. But like 2 to 5 is decent.

You may need to make a change to, MIME::Lite->send, if you are not running sendmail. You can tell it to use sendmail, or smtp. If you use smtp, tell the script which smtp host to use.


Place the following code for the applet in your web page. Edit the code to reflect the values you need:

<!-- Set the width and height-->
<applet code="sign.class" name="sign" width="" height="">

<!-- Set the color of the pen in R,G,B -->
<param name="pencolor" value="">

<!-- Set the thickness of the pen -->
<param name="thickness" value="2">

<!-- Set the color of the background in R,G,B -->
<param name="bgcolor" value="">

<!-- Set the background image. -->
<!-- File must exist on the server in both the directory of this page and the directory of the signature script. -->
<param name="background" value="">

<!-- Set a premade signature -->
<param name="signature" value="">

</applet>


If you have a predefined signature code, enter it in the value for the signature tag above.


The following is for the form to use. Set the action to have the value of the CGI script on your server.

Edit the subject and filename of the signature as you see fit.
You'll need to set your email address to the script knows where to send the message to. Also, you'll need to provide fields for the visitor to fill in their own name and email address.

<form action="/cgi-bin/signature.cgi" method="post" onsubmit="if (sign) {
signature.value=sign.signature();
PR.value=sign.PR();
PG.value=sign.PG();
PB.value=sign.PB();
BR.value=sign.BR();
BG.value=sign.BG();
BB.value=sign.BB();

width.value=sign.imagewidth();
height.value=sign.imageheight();
background.value=sign.backgroundimage();
}">

<input type="hidden" name="signature" value="">

<!-- Set the address to send the signature to -->
<input type="hidden" name="mailto" value="">

<!-- Optional values for the form are: -->
<!-- The subject of the email. Default is "Signature" -->
<input type="hidden" name="subject" value="">
<!-- The filename of the image that contains the signature. The default is signature.png -->
<!-- The image format is PNG only. If you want to change the type, you must edit the server script. -->
<input type="hidden" name="filename" value="">

<!-- URL to go to after the form is sent.-->
<input type="hidden" name="done" value="">

<!-- Name of the sender-->
<input type="text" name="name" value="">

<!-- Email of the sender-->
<input type="text" name="email" value="">

<input type="hidden" name="PR" value="">
<input type="hidden" name="PG" value="">
<input type="hidden" name="PB" value="">
<input type="hidden" name="BR" value="">
<input type="hidden" name="BG" value="">
<input type="hidden" name="BB" value="">
<input type="hidden" name="width" value="">
<input type="hidden" name="height" value="">
<input type="hidden" name="background" value="">

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

<input type="submit" value="Send">
</form>

 

Sample Form

This sample form does not send the signature anywhere. It's more of a template to be filled in with other values.

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 the size of the applet you placed on your site.

Test Area

Lets you sign, find the polygons, clear the screen, and replace them. Used for grabbing the signatures to make your own saved version.

Example Saved Signature

Here is an example of something that was saved.

Online sample

Feedback

Visit my web site for other software

Thank you,

Lawrence Goetz