# Signature Pad Documentation
**A jQuery plugin for assisting in the creation of an HTML5 canvas based signature pad. Records the drawn signature in JSON for later regeneration.**
---
- [Introduction](#introduction)
- [Demos](#demos)
- [Demo of accepting a signature](https://thomasjbradley.github.io/signature-pad/examples/accept-signature.html)
- [Demo of requiring a drawn signature](https://thomasjbradley.github.io/signature-pad/examples/require-drawn-signature.html)
- [Demo of regenerating a signature](https://thomasjbradley.github.io/signature-pad/examples/regenerate-signature.html)
- [Using the Plugin](#using-the-plugin)
- [How to Use the Plugin](#how-to-use-the-plugin)
- [Javascript](#javascript)
- [HTML Template](#html-template)
- [Further HTML Explanation](#further-html-explanation)
- [Form Submission & Validation](#form-submission--validation)
- [Require a Drawn Signature](#require-a-drawn-signature)
- [Regenerating Signatures](#regenerating-signatures)
- [Regenerating Javascript](#regenerating-javascript)
- [Alternate Javascript](#alternate-javascript)
- [Regenerating HTML Template](#regenerating-html-template)
- [Resizing the Signature Pad](#resizing-the-signature-pad)
- [Converting to an Image](#converting-to-an-image)
- [Client Side](#client-side)
- [Server Side](#server-side)
- [Saving to a Database](#saving-to-a-database)
- [PHP & MySQL Tutorial](#php--mysql-tutorial)
- [Options](#options)
- [Changing Default Options](#changing-default-options)
- [Options Reference](#options-reference)
- [API](#api)
- [API Reference](#api-reference)
- [API Limitations](#api-limitations)
- [Compressing the Output](#compressing-the-output)
- [Version History](#version-history)
- [License](#license)
---
## Introduction
The Signature Pad jQuery plugin will transform an HTML form into a signature pad. The Signature Pad has two modes: TypeIt and DrawIt. In TypeIt mode the user’s signature is automatically generated as HTML text, styled with `@font-face`, from the input field where they type their name. In DrawIt mode the user is able to draw their signature on the canvas element.
The drawn signature is written out to a hidden input field as a JSON array using `JSON.stringify()`. Since the signature is saved as JSON it can be submitted as part of the form and kept on file. Using the JSON array, the signature can then be regenerated into the canvas element for display.
*Obviously, Signature Pad has a couple extra dependencies: [Douglas Crockford’s json2.js](http://www.json.org/js.html) and [FlashCanvas 1.5](http://flashcanvas.net/). (Both scripts are included in the downloadable package.)*
Signature Pad tries to maintain a certain level of progressive enhancement, while still giving developers enough control. There is very little generated HTML. The HTML in the examples has some elements that should be hidden by default (including canvas). Signature Pad will trigger the display of certain items if the browser supports Javascript and canvas.
**Signature Pad works with both mouse and touch devices.**
Get the source code on GitHub:
Review your signature
Draw your signature
``` These two paragraphs, `.typeItDesc` and `.drawItDesc` are used as descriptive labels for the canvas Signature Pad. They are hidden or shown depending on whether the user is drawing their signature or using the automatically generated one. ```htmlReview your signature
``` and **delete**: ```htmlSir John A. Macdonald
July 1, 1867