Full version integration instructions

Integration with an Android application

If you want to use Signature Capture from your Android application, all you need to do is call the appropriate activity and pass the desired parameters. Your application will receive a notification when the file with the captured signature is ready for reading. Below, you’ll find code snippets:

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 keyCrop            = "biz.binarysolutions.signature.Crop";
String keyWidth           = "biz.binarysolutions.signature.Width";
String keyHeight          = "biz.binarysolutions.signature.Height";
String keyBackgroundColor = "biz.binarysolutions.signature.BackgroundColor";
String keyBackgroundImage = "biz.binarysolutions.signature.BackgroundImage";
String keyKeepSignature   = "biz.binarysolutions.signature.KeepSignature";
String  code            = "";             // your purchase transaction id
String  fileName        = "";             // set the file name (see important notes bellow!)
String  title           = "";             // optional, default is 'Signature Capture'
int     strokeWidth     = 10;             // optional, default is 8
String  strokeColor     = "FF0000FF";     // optional, default is BLACK (FF000000)
boolean crop            = false;          // optional, default is true
String  backgroundColor = "FF00FF00";     // optional, default is fully transparent
String  backgroundImage =                 // optional, default is none
// allowed units: px, dp, dip, sp, pt, mm, in
String width  = "300dp";                  // optional, default is max
String height = "100dp";                  // same as above
/* The following parameter is available only when targeting API level 30 or above.
   If set to true, the signature file is persisted in Signature Capture's directory.
boolean keepSignature = true;               // optional, default is false
intent.putExtra(keyCode, code);
intent.putExtra(keyFileName, fileName);
intent.putExtra(keyTitle, title);
intent.putExtra(keyStrokeWidth, strokeWidth);
intent.putExtra(keyStrokeColor, strokeColor);
intent.putExtra(keyCrop, crop);
intent.putExtra(keyWidth, width);
intent.putExtra(keyHeight, height);
intent.putExtra(keyBackgroundColor, backgroundColor);
intent.putExtra(keyBackgroundImage, backgroundImage);
intent.putExtra(keyKeepSignature, keepSignature);
    new ComponentName(
startActivityForResult(intent, CAPTURE_REQUEST_CODE);
Important notes regarding the file name

If you are using Signature Capture that is targeting API 30 or above

You need to provide the file name, excluding the path but including the extension (png).

If you are using Signature Capture that is targeting API 29

You must provide the full path name, including the extension (png). The file itself doesn’t need to exist, but all directories along the path must exist. Additionally, the file must have global write permissions. This usually means storing it on the SD Card. You can use one of the following methods to obtain writable storage:


All file naming restrictions that apply to the Android (Linux) file system also apply here.

Receiving the result (target API 30 or above)

public void onActivityResult(int request, int result, Intent intent) {
    super.onActivityResult(request, result, intent);
    if (request != CAPTURE_REQUEST_CODE || intent == null) {
    if (result == RESULT_OK) {
        try {
            FileDescriptor descriptor =
                getContentResolver().openFileDescriptor(intent.getData(), "r")
            // read file descriptor and do with bitmap whatever you like
        } catch (NameNotFoundException e) {
    } else {
        String errorMessage = intent.getStringExtra("biz.binarysolutions.signature.ErrorMessage");
        // handle the error

Receiving the result (target API 29 or bellow)

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");
        // handle the error

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 (targeting API level 29 and bellow),
Signature Share (targeting API level 30 and above).

Integration with a Web site

You can also initiate Signature Capture from your website when viewed in the Android browser. In this scenario, the captured signature will not be saved on the device but will be uploaded to your server instead. To start the Signature Capture activity, use the clickable link provided below:

<a href="
    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).
  • ‘BackgroundImage’ part is optional, default value is none. If it is given, it has to be properly encoded URL of the background image, i.e. watermark.
  • ‘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 FastSpring) 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 snippet demonstrates how to fetch the file on server side in PHP:

$newFilePath = "./signature.png";
file_put_contents($newFilePath, file_get_contents('php://input'));

The following snippet 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

Embedding the Signature Capture library in your own app

We strongly advise that you use the free version of Signature Capture during application development and testing. Once you have completed this phase, switching to a Developer License is a straightforward process.

Integration instructions, usage guidelines, and license information for the Developer License are available in the sample package. We recommend reviewing the package before making a purchase.

Please note that the sample package does not include AAR files; you will receive them after making the purchase.