Signature Image Extraction

This guide shows you how to extract a sender’s capture signature from an account and a signer’s capture signature from a package.

An account manager can extract the signature image for any Sender. The default signature image size is 350 x 100 pixels.

If the sender does not exist or the sender does not have a captured signature, an “error.notFound.userNotFound” exception is thrown. If the image type is invalid or not supported, an “error.validation.signatureImageType” exception is thrown. This feature is only available in version 11 of OneSpan Sign.

The Code

To download a sender’s signature as an image file, you call on the SignatureImageService and pass the sender id and the format you wish to download the signature.

DownloadedFile senderImage = eslClient.getSignatureImageService().getSignatureImageForSender("{senderId}", SignatureImageFormat.PNG);
byte[] senderImageByte = senderImage.getContents();
        
FileOutputStream stream = new FileOutputStream("C:/Users/hhaidary/Desktop/senderImage.png");
        
try {
   stream.write(senderImageByte);
} finally {
   stream.close();
}

Then, you open a new FileOutputStream to write the data to a destination of your choice. If you don’t know how to retrieve the sender id, you can follow this following guide on senders. Also, you can choose to download the images in PNG, JPEG, or GIF format.

Similarly, to download a specific signer’s captured signature from a package, you call on the SignatureImageService and pass the package id, signer id, and the format you wish to download the signature.

PackageId packageId = new PackageId("IP-lS6_GYWlKr4moDNWMEWJOuJc=");
        
DownloadedFile signerImage = eslClient.getSignatureImageService().getSignatureImageForPackageRole(packageId, "signer1", SignatureImageFormat.JPG);
byte[] signerImageByte = senderImage.getContents();
        
stream = new FileOutputStream("C:/Users/hhaidary/Desktop/signerImage.png");
        
try {
   stream.write(signerImageByte);
} finally {
   stream.close();
}

Note that these calls only work exclusively for signatures of type “CAPTURE”.

Get the Code

An account manager can extract the signature image for any Sender. The default signature image size is 350 x 100 pixels.

If the sender does not exist or the sender does not have a captured signature, an “error.notFound.userNotFound” exception is thrown. If the image type is invalid or not supported, an “error.validation.signatureImageType” exception is thrown. This feature is only available in version 11 of OneSpan Sign.

The Code

To download a sender’s signature as an image file, you call on the SignatureImageService and pass the sender id and the format you wish to download the signature.

DownloadedFile senderImage = eslClient.SignatureImageService.GetSignatureImageForSender("rNs5hVUQ0mQY", SignatureImageFormat.PNG);
byte[] senderImageByte = senderImage.Contents;  

try
{
    File.WriteAllBytes("C:/Users/hhaidary/Desktop/senderImage.png", senderImageByte);
}
catch(Exception e)
{
    Debug.WriteLine(e);
}

Then, you open a new File to write the data to a destination of your choice. If you don’t know how to retrieve the sender id, you can follow this following guide on senders. Also, you can choose to download the images in PNG, JPEG, or GIF format.

Similarly, to download a specific signer’s captured signature from a package, you call on the SignatureImageService and pass the package id, signer id, and the format you wish to download the signature.

PackageId packageId = new PackageId("IP-lS6_GYWlKr4moDNWMEWJOuJc=");

DownloadedFile signerImage = eslClient.SignatureImageService.GetSignatureImageForPackageRole(packageId, "signer1", SignatureImageFormat.JPG);
byte[] signerImageByte = senderImage.Contents;

try
{
    File.WriteAllBytes("C:/Users/hhaidary/Desktop/signerImage.png", signerImageByte);
}
catch (Exception e)
{
    Debug.WriteLine(e);
}

Note that these calls only work exclusively for signatures of type “CAPTURE”.

Get the Code

An account manager can extract the signature image for any Sender. The default signature image size is 350 x 100 pixels.

If the sender does not exist or the sender does not have a captured signature, an “error.notFound.userNotFound” exception is thrown. If the image type is invalid or not supported, an “error.validation.signatureImageType” exception is thrown. This feature is only available in version 11 of OneSpan Sign.

The Code

You can download a sender’s signature image like so:

HTTP Request
GET /api/account/senders/{senderId}/signatureImage

HTTP Headers
Accept: image/png,image/jpeg,image/gif
Content-Type: application/json
Authorization: Basic api_key

Response Payload

[image/png]

If you don’t know how to retrieve the sender id, you can follow this following guide on senders. Also, you can choose to download the images in PNG, JPEG, or GIF format.

Similarly, to download a specific signer’s captured signature from a package, you make a:

HTTP Request
GET /api/packages/{packageId}/roles/{roleId}/signatureImage

HTTP Headers
Accept: image/png,image/jpeg,image/gif
Content-Type: application/json
Authorization: Basic api_key

Response Payload

[image/png]

In this case, you will need the package id and role id of the signer. Note that these calls only work exclusively for signatures of type “CAPTURE”.

Get the Code

An account manager can extract the signature image for any Sender. The default signature image size is 350 x 100 pixels.This feature is only available in version 11 of OneSpan Sign.
To notice, some of the code is an extension of the APEX SDK and can be gotten through this Code Share.

The Code

To download a sender’s signature as an image file, you call below encapsulated function and pass the sender ID to download the signature.

    	//Get Signature Image For Sender 
    	String senderId = 'ATQOPd60xE4V';
    	Blob signatureImageForSender = getSignatureImageForSender(senderId);

Then, you write the data to a destination of your choice. If you don’t know how to retrieve the sender id, you can follow this following guide on senders.

		//store blob
        Document signatureImageForSenderDocument = new Document();
        signatureImageForSenderDocument.Body = signatureImageForSender;
        signatureImageForSenderDocument.FolderId = folder.id;
        signatureImageForSenderDocument.Name = 'Signature image for sender: '+ senderId +' - ' + Datetime.now().format();
        signatureImageForSenderDocument.Type = 'jpg';
        documents.add(signatureImageForSenderDocument);

Also, you can choose to store the images in PNG, JPEG, or GIF type.

Similarly, to download a specific signer’s captured signature from a package, you call on the below encapsulated function and pass the Package ID, Role ID.

        String packageId = 'E-cmEaSbHjLDNf631aj3Y8-hvCk=';
        String roleId = 'Signer2'; 
        Blob signatureImageForPackageRole = getSignatureImageForPackageRole(packageId,roleId);

And you can save the Blob object to anywhere you see fit with type of PNG, JPEG or GIF.

Note that these calls only work exclusively for signatures of type “CAPTURE” or “MOBILE_CAPTURE”.

Get the Code