Signature Capture for Android



About

Electronic signature capture library for Android. Sign by touching the screen. Start as a normal app for demo. Requires internet connection. When used from external app saves/exports up to 5 signatures per week. Demo is free and it can be downloaded from Android Market here:
https://market.android.com/details?id=biz.binarysolutions.signature

You can scan the following QR code as well:


Signature Capture library is available for download on a number of alternative Android application stores. You can also download it directly from the following URL:
http://goo.gl/LqSN6

If you are an Android developer and you would like to request a new feature to be implemented, you can do it here:
http://signaturecapture.uservoice.com/

In case you need support with library integration and usage, you can always contact us at the following email address: support+sc@binarysolutions.biz. We'll do our best to respond promptly.

For signature saving and sharing check our application named Signature Share. It externally depends on Signature Capture so you will need both of them installed on your Android device. Signature Share is also free and it is available on Android Market here:
https://market.android.com/details?id=biz.binarysolutions.signature.share

Signature Share is open source application and you can access it's source code here:
http://code.google.com/p/signature-share/

For PDF signing check out our free application Fill and Sign PDF Forms. It also depends on Signature Capture library.

Pricing

Demo/Trial
  • Data connection required
  • Unlimited number of devices
  • Max. 5 signatures per week
  • Price: free

Standard LicenseDeveloper License
  • APK file signed by Binary Solutions
  • Data connection required only during the license activation
  • Valid on a single device
  • Unlimited number of signatures
  • Free updates
  • JAR file for embedding in a single Android project (application)
  • Data connection not required
  • Unlimited number of devices
  • Unlimited number of signatures
  • 40% discount for upgraded releases
Price: $8.99Price: $299
Secure Online Payments and Credit Card Processing by FastSpringSecure Online Payments and Credit Card Processing by FastSpring


Developer License instructions

We strongly advice that you use the free version during the application development and testing. Once you are done, switching to Developer License is an easy process.

Integration instructions, usage instructions and license information for Developer License are available in sample package here. Please go through the package before you decide to make a purchase.

Sample package does not contain JAR file. You get that one after the purchase.


Standard License instructions

Integration with Android application

If you want to use Signature Capture from your own Android application, all you have to do is to call the right activity and pass it a file name (with full path) where you want the captured signature to be stored. File has to have global writting permissions set and 'png' extension. Your application will receive notification when file is saved and ready for reading. Code snippets follow:
  • Calling the Signature Capture activity
Intent intent = new Intent("biz.binarysolutions.signature.CAPTURE");

String keyCode            = "biz.binarysolutions.signature.ActivationCode";
String keyFileName        = "biz.binarysolutions.signature.FileName";
String keyTitle           = "biz.binarysolutions.signature.Title";
String keyStrokeWidth     = "biz.binarysolutions.signature.StrokeWidth";
String keyStrokeColor     = "biz.binarysolutions.signature.StrokeColor";
String keyBackgroundColor = "biz.binarysolutions.signature.BackgroundColor";
String keyCrop            = "biz.binarysolutions.signature.Crop";
String keyWidth           = "biz.binarysolutions.signature.Width";
String keyHeight          = "biz.binarysolutions.signature.Height";

String  code        = "";     // your purchase transaction id
String  fileName    = "";     // set the file name (global write permissions)
String  title       = "";     // optional, default is 'Signature Capture'
int     strokeWidth = 10;     // optional, default is 8
String  strokeColor = "FF0000FF";     // optional, default is BLACK (FF000000)
String  backgroundColor = "FF00FF00"; // optional, default is fully transparent
boolean crop        = false;  // optional, default is true

// allowed units: px, dp, dip, sp, pt, mm, in
String width  = "300dp"; // optional, default is max
String height = "100dp"; // same as above

intent.putExtra(keyCode, code);
intent.putExtra(keyFileName, fileName);
intent.putExtra(keyTitle, title);
intent.putExtra(keyStrokeWidth, strokeWidth);
intent.putExtra(keyStrokeColor, strokeColor);
intent.putExtra(keyBackgroundColor, backgroundColor);
intent.putExtra(keyCrop, crop);
intent.putExtra(keyWidth, width);
intent.putExtra(keyHeight, height);

intent.setComponent(
    new ComponentName(
        "biz.binarysolutions.signature",
        "biz.binarysolutions.signature.Capture"
    )
);

startActivityForResult(intent, CAPTURE_REQUEST_CODE);
Important notes regarding the file name: Once again, file has to have global write permissions. This means that you will (most likely) store it on SD Card. Use one of the following methods in order to obtain writeable storage:

Environment.getExternalStorageDirectory()
Environment.getExternalStoragePublicDirectory()

You have to provide the full path name, including the extension (png). The file itself does not have to exist but all directories on the path have to. All file name restrictions that exist for Android (Linux) file system are valid here too.
  • Receiving the result
@Override
protected void onActivityResult
    (
         int    requestCode,
         int    resultCode,
         Intent data
    ) {
    super.onActivityResult(requestCode, resultCode, data);

    if (requestCode == CAPTURE_REQUEST_CODE) {
        if (resultCode == RESULT_OK) {

            String fileName = ""; // the same file name as above
            Bitmap bitmap   = BitmapFactory.decodeFile(fileName);

            // do with bitmap whatever you like

        } else {

            String errorMessage = data.getStringExtra(
                "biz.binarysolutions.signature.ErrorMessage");
        }
    }
}
If you would like to see the full working example, you can take a look at our application called Signature Share. It's source code is released under the Apache License 2.0 and it is available here: Signature Share project home.

Integration with Web site

You can also start Signature Capture from your web site shown in Android browser. In this case captured signature will not be saved on a device but uploaded to your server instead. Clickable link that will start Signature Capture activity is the following:
<a href="
    intent:#Intent;
    action=biz.binarysolutions.signature.CAPTURE;
    S.biz.binarysolutions.signature.Title=Signature%20Capture;
    i.biz.binarysolutions.signature.StrokeWidth=10;
    S.biz.binarysolutions.signature.StrokeColor=FF0000FF;
    S.biz.binarysolutions.signature.BackgroundColor=FF00FF00;
    B.biz.binarysolutions.signature.Crop=false;
    S.biz.binarysolutions.signature.Width=300dp;
    S.biz.binarysolutions.signature.Height=100dp;
    S.biz.binarysolutions.signature.ActivationCode=;
    S.biz.binarysolutions.signature.UploadURL=
        http%3A%2F%2Fwww.example.com%2Freceiver_script;
    S.biz.binarysolutions.signature.SuccessURL=
        http%3A%2F%2Fwww.example.com%2Fsuccess.html;
    S.biz.binarysolutions.signature.FailureURL=
        http%3A%2F%2Fwww.example.com%2Ffailure.html;
    end">Click to capture signature!</a>
  • 'href' value has to be in a single line! Example here is in multiple lines in order to fit on screen and be more clear.
  • 'S.biz.binarysolutions.signature.Title=;' part is optional, if it is set it has to be encoded, default value is 'Signature Capture'.
  • 'i.biz.binarysolutions.signature.StrokeWidth=10;' part is optional, default value is 8.
  • 'S.biz.binarysolutions.signature.StrokeColor=FF0000FF;' part is optional, default value is FF000000.
  • 'S.biz.binarysolutions.signature.BackgroundColor=FF00FF00;' part is optional, default value is 00000000 (fully transparent).
  • 'B.biz.binarysolutions.signature.Crop=false;' part is optional, default value is true.
  • 'S.biz.binarysolutions.signature.Width' and 'S.biz.binarysolutions.signature.Height' parts are optional, they represent the capture window width and height, respectively. Default values are max screen dimensions. Allowed units are: px, dp, dip, sp, pt, mm and in.
  • Add your invoice id (if you have purchased the app via Plimus) or transaction id (if you have purchased the app via PayPal) right after 'ActivationCode=' and before the first next ';'.
  • 'UploadURL' has to point to your server-side script and it has to be properly encoded. Spaces have to be encoded with '+' instead of '%20'. In this example, url of the script is http://www.example.com/receiver_script
    Look below for more info on handling the uploaded image on server side.
  • 'SuccessURL' and 'FailureURL' are optional parameters. Depending on the success of signature upload, application user will be directed to one of these two URL's afterwards.
For reference and URL encoding tools, check the HTML URL Encoding Reference (Thanks to Vu Nguyen).

The following snipped demonstrates how to fetch the file on server side in PHP:
<?php
$newFilePath = "./signature.png";
$fh = fopen($newFilePath, 'wb');
fwrite($fh, $GLOBALS["HTTP_RAW_POST_DATA"])
    or die("unable to write data");
fclose($fh);
?>
The following snipped demonstrates how to fetch the file on server side in ASP.NET (code sample provided by Vu Nguyen):
Protected Sub Page_Load(ByVal sender As Object,
    ByVal e As System.EventArgs) Handles Me.Load

    Dim filePath = "" 'Set your file path and name here'

    Using bmp As New System.Drawing.Bitmap(Request.InputStream)
        bmp.Save(filePath, System.Drawing.Imaging.ImageFormat.Png)
    End Using

End Sub