To download the full code sample see our Code Share site.

This topic describes how to sign all signatures in a transaction using a single call, instead of navigating through each document successively, and signing each signature sequentially.

In this example:

  • There are two Recipients in the transaction: the sender and a client.

  • There are two documents in the transaction.

  • Text anchors are used to position the signatures on the documents. For more information, see Text Anchors.

  • The sample PDF used in this guide can be download here.

The following code will sign all signatures in the transaction.

// Package   PackageBuilder packageToBuild =
// PackageBuilder.newPackageNamed("Sign Documents Test");   //Sender
// SignerBuilder signer1 =
// SignerBuilder.newSignerWithEmail("[email protected]")
// .withFirstName("Haris")   .withLastName("Haidary")   .withCustomId("Sender");
// //Client   SignerBuilder signer2 =
// SignerBuilder.newSignerWithEmail("[email protected]") .withFirstName("John")
// .withLastName("Smith")   .withCustomId("Signer");   //Sender signature on
// first document   SignatureBuilder signature1 =
// SignatureBuilder.signatureFor("[email protected]")
// .withPositionAnchor(TextAnchorBuilder.newTextAnchor("Signature of the
// Contractor")   .atPosition(TextAnchorPosition.TOPLEFT)   .withSize(150, 40)
// .withOffset(0, -50)   .withCharacter(0)   .withOccurence(0));   //Client
// signature on first document   SignatureBuilder signature2 =
// SignatureBuilder.signatureFor("[email protected]")
// .withPositionAnchor(TextAnchorBuilder.newTextAnchor("Signature of the
// Client")   .atPosition(TextAnchorPosition.TOPLEFT)   .withSize(150, 40)
// .withOffset(0, -50)   .withCharacter(0)   .withOccurence(0));   //First
// document   DocumentBuilder document1 =
// DocumentBuilder.newDocumentWithName("Cleaning Contract")
// .fromFile("DOC_FILE_PATH")   .withSignature(signature1)
// .withSignature(signature2);   //Build package   DocumentPackage packageToSend
// =
// packageToBuild.withSigner(signer1).withSigner(signer2).withDocument(document1).withDocument(document2).build();
// //Create and send package   PackageId packageId =
// client.createAndSendPackage(packageToSend);   //sign all documents for sender
// client.signDocuments(packageId);

The last line in this sample code automatically signs all documents for the sender.

This feature will not work for capture signatures.

Results

Once you have run your code, log into OneSpan Sign. You will see a checkmark next to your sender. This confirms that all signatures for the sender have been applied.

To download the full code sample see our Code Share site.

This topic describes how to sign all signatures in a transaction using a single call, instead of navigating through each document successively, and signing each signature sequentially.

In this example:

  • There are two Recipients in the transaction: the sender and a client.

  • There are two documents in the transaction.

  • Text anchors are used to position the signatures on the documents. For more information, see Text Anchors.

  • The sample PDF used in this guide can be download here.

The following code will sign all signatures in the transaction.

//Package   PackageBuilder packageToBuild = PackageBuilder.NewPackageNamed("Sign Documents Test");   
//Sender   SignerBuilder signer1 = SignerBuilder.NewSignerWithEmail("[email protected]")   .WithFirstName("Haris")   .WithLastName("Haidary")   .WithCustomId("Sender");   
//Client   SignerBuilder signer2 = SignerBuilder.NewSignerWithEmail("[email protected]")   .WithFirstName("John")   .WithLastName("Smith")   .WithCustomId("Signer");   
//Sender signature on first document   SignatureBuilder signature1 = SignatureBuilder.SignatureFor("[email protected]")   .WithPositionAnchor(TextAnchorBuilder.NewTextAnchor("Signature of the Contractor")   .AtPosition(TextAnchorPosition.TOPLEFT)   .WithSize(150, 40)   .WithOffset(0, -50)   .WithCharacter(0)   .WithOccurrence(0));   
//Client signature on first document   SignatureBuilder signature2 = SignatureBuilder.SignatureFor("[email protected]")   .WithPositionAnchor(TextAnchorBuilder.NewTextAnchor("Signature of the Client")   .AtPosition(TextAnchorPosition.TOPLEFT)   .WithSize(150, 40)   .WithOffset(0, -50)   .WithCharacter(0)   .WithOccurrence(0));   
//First document   DocumentBuilder document1 = DocumentBuilder.NewDocumentNamed("Cleaning Contract")   .FromFile("DOC_FILE_PATH")   .WithSignature(signature1)   .WithSignature(signature2);   
//Build package   DocumentPackage packageToSend = packageToBuild.WithSigner(signer1).WithSigner(signer2).WithDocument(document1).WithDocument(document2).Build();   
//Create and send package   PackageId packageId = client.CreateAndSendPackage(packageToSend);   
//Sign all documents for sender   client.SignDocuments(packageId); 

The last line in this sample code automatically signs all documents for the sender.

This feature will not work for capture signatures.

Results

Once you have run your code, log into OneSpan Sign. You will see a checkmark next to your sender. This confirms that all signatures for the sender have been applied.

To download the full code sample see our Code Share site.

This topic describes how to sign all signatures in a transaction using a single call, instead of navigating through each document successively, and signing each signature sequentially.

In this example:

  • There are two Recipients in the transaction: the sender and a client.

  • There are two documents in the transaction.

  • Text anchors are used to position the signatures on the documents. For more information, see Text Anchors.

  • The sample PDF used in this guide can be download here.

HTTP Request

POST /api/packages

HTTP Headers

Accept: application/json   
Content-Type: multipart/form-data   
Authorization: Basic api_key 

Request Payload

 -- -- --WebKitFormBoundary1bNO60n7FqP5WO4t Content - Disposition: form - data;
name = "file";
filename = "testDocumentExtraction.pdf"
Content - Type: application / pdf % PDF - 1.5 % µµµµ 1 0 obj < >>> endobj....-- -- --WebKitFormBoundary1bNO60n7FqP5WO4t Content - Disposition: form - data;
name = "payload"
"roles": [{
	"id": "Signer",
	"type": "SIGNER",
	"signers": [{
		"firstName": "John",
		"lastName": "Smith",
		"email": "[email protected]"
	}],
	"name": "Signer"
}, {
	"id": "Sender",
	"type": "SIGNER",
	"signers": [{
		"firstName": "Haris",
		"lastName": "Haidary",
		"email": "[email protected]"
	}],
	"name": "Sender"
}], "documents": [{
	"approvals": [{
		"fields": [{
			"type": "SIGNATURE",
			"extract": false,
			"extractAnchor": {
				"text": "Signature of the Client",
				"index": 0,
				"width": 150,
				"height": 40,
				"anchorPoint": "TOPLEFT",
				"characterIndex": 0,
				"leftOffset": 0,
				"topOffset": -50
			},
			"left": 0,
			"subtype": "FULLNAME",
			"top": 0
		}, {
			"value": null,
			"type": "INPUT",
			"binding": "{signer.name}",
			"extract": false,
			"extractAnchor": {
				"text": "(hereafter referred to as",
				"index": 0,
				"width": 150,
				"height": 20,
				"anchorPoint": "TOPRIGHT",
				"characterIndex": 0,
				"leftOffset": -175,
				"topOffset": -5
			},
			"left": 0,
			"subtype": "LABEL",
			"top": 0
		}, {
			"value": null,
			"type": "INPUT",
			"binding": "{approval.signed}",
			"extract": false,
			"extractAnchor": {
				"text": "Date",
				"index": 0,
				"width": 75,
				"height": 40,
				"anchorPoint": "TOPRIGHT",
				"characterIndex": 4,
				"leftOffset": 10,
				"topOffset": -30
			},
			"left": 0,
			"subtype": "LABEL",
			"top": 0
		}],
		"role": "Signer"
	}, {
		"fields": [{
			"type": "SIGNATURE",
			"extract": false,
			"extractAnchor": {
				"text": "Signature of the Contractor",
				"index": 0,
				"width": 150,
				"height": 40,
				"anchorPoint": "TOPLEFT",
				"characterIndex": 0,
				"leftOffset": 0,
				"topOffset": -50
			},
			"subtype": "FULLNAME"
		}],
		"role": "Sender"
	}],
	"id": "contract",
	"name": "Sample Contract"
}], "name": "Sign Documents Test", "type": "PACKAGE", "language": "en", "autoComplete": true, "status": "SENT"
}-- -- --WebKitFormBoundary1bNO60n7FqP5WO4t--

For a complete description of each field, see the Request Payload table below.

Response Payload

 {   "id": "9sKhW-h-qS9m6Ho3zRv3n2a-rkI="   } 

Once you have sent your transaction, you make a POST request to:

HTTP Request

POST /api/packages/{packageId}/documents/signed_documents

HTTP Headers

Accept: application/json   
Content-Type: application/json   
Authorization: Basic api_key 
 {   "documents": [   {   "id": "contract",   "name": "Sample Contract"   }   ]   } 

The last line in this sample code automatically signs all documents for the sender.

This feature will not work for capture signatures.

Results

Once you have run your code, log into OneSpan Sign. You will see a checkmark next to your sender. This confirms that all signatures for the sender have been applied.

Request Payload Table

PropertyTypeEditableRequiredDefaultSample Values
statusstringYesNoDRAFTDRAFT / SENT / COMPLETED / ARCHIVED / DECLINED / OPTED_OUT / EXPIRED
autoCompletebooleanYesNotruetrue / false
typestringYesNoPACKAGEPACKAGE / TEMPLATE / LAYOUT
namestringYesYesn/aText Anchor Extraction Example REST API
languagestringYesYesenen / fr / de ...
documents
namestringYesNon/aSample Contract
approvals
rolestringYesNon/aclient
fields
typestringYesYesn/aSIGNATURE / INPUT
extractbooleanYesNofalsetrue / false
subtypestringYesYesn/aFULLNAME / INITIALS / CAPTURE / MOBILE_CAPTURE / LABEL / TEXTFIELD / TEXTAREA / CHECKBOX / DATE / RADIO / LIST
bindingstringYesNonullnull / {approval.signed} / {signer.title} / {signer.name} / {signer.company}
leftintegerYesNo00 / 10 / 20 ...
topintegerYesNo00 / 10 / 20 ...
extractAnchor
textstringYesYesn/aSignature of the Client
anchorPointstringYesYesn/aTOPLEFT / TOPRIGHT / BOTTOMLEFT / BOTTOMRIGHT
indexintegerYesNo00 / 1 / 2 ...
widthintegerYesNo200150
characterIndexintegerYesNo00
heightintegerYesNo5040
leftOffsetintegerYesNo040
rightOffsetintegerYesNo0-10
roles
idstringYesNon/aclient
indexintegerYesNo01 / 2 / 3 ...
namestringYesNon/aclient
typestringYesNoSIGNERSIGNER / SENDER
signers
emailstringYesYesn/a[email protected]
firstNamestringYesYesn/aJohn
lastNamestringYesYesn/aSmith
idstringYesNon/aclient

To download the full code sample see our Code Share site.

This topic describes how to sign all signatures in a transaction using a single call, instead of navigating through each document successively, and signing each signature sequentially.

In this example:

  • There are two Recipients in the transaction: the sender and a client.

  • There are two documents in the transaction.

  • Text anchors are used to position the signatures on the documents. For more information, see Text Anchors.

  • The sample PDF used in this guide can be download here.

After you have sent your package for signing, you will need to retrieve your packageID. Then, use the following code to sign all signatures in the transaction.:

 public void signDocuments(String packageId) 

Results

Once you have run your code, log into OneSpan Sign. You will see a checkmark next to your sender. This confirms that all signatures for the sender have been applied.