Applying All Signatures in One Call
  • 10 Oct 2024
  • 6 Minutes à lire
  • Sombre
    Lumière
  • PDF

Applying All Signatures in One Call

  • Sombre
    Lumière
  • PDF

The content is currently unavailable in French. You are viewing the default English version.
Résumé de l’article

Java SDK.NET SDKREST APIAPEX SDK

Java SDK

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("sender@example.com")
// .withFirstName("Haris")   .withLastName("Haidary")   .withCustomId("Sender");
// //Client   SignerBuilder signer2 =
// SignerBuilder.newSignerWithEmail("client@example.com") .withFirstName("John")
// .withLastName("Smith")   .withCustomId("Signer");   //Sender signature on
// first document   SignatureBuilder signature1 =
// SignatureBuilder.signatureFor("sender@example.com")
// .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("client@example.com")
// .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.

.NET SDK

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("sender@example.com")   .WithFirstName("Haris")   .WithLastName("Haidary")   .WithCustomId("Sender");   
//Client   SignerBuilder signer2 = SignerBuilder.NewSignerWithEmail("client@example.com")   .WithFirstName("John")   .WithLastName("Smith")   .WithCustomId("Signer");   
//Sender signature on first document   SignatureBuilder signature1 = SignatureBuilder.SignatureFor("sender@example.com")   .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("client@example.com")   .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.

REST API

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": "signer@example.com"
	}],
	"name": "Signer"
}, {
	"id": "Sender",
	"type": "SIGNER",
	"signers": [{
		"firstName": "Haris",
		"lastName": "Haidary",
		"email": "sender@example.com"
	}],
	"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

Property

Type

Editable

Required

Default

Sample Values

status

string

Yes

No

DRAFT

DRAFT / SENT / COMPLETED / ARCHIVED / DECLINED / OPTED_OUT / EXPIRED

autoComplete

boolean

Yes

No

true

true / false

type

string

Yes

No

PACKAGE

PACKAGE / TEMPLATE / LAYOUT

name

string

Yes

Yes

n/a

Text Anchor Extraction Example REST API

language

string

Yes

Yes

en

en / fr / de ...

documents

name

string

Yes

No

n/a

Sample Contract

approvals

role

string

Yes

No

n/a

client

fields

type

string

Yes

Yes

n/a

SIGNATURE / INPUT

extract

boolean

Yes

No

false

true / false

subtype

string

Yes

Yes

n/a

FULLNAME / INITIALS / CAPTURE / MOBILE_CAPTURE / LABEL / TEXTFIELD / TEXTAREA / CHECKBOX / DATE / RADIO / LIST

binding

string

Yes

No

null

null / {approval.signed} / {signer.title} / {signer.name} / {signer.company}

left

integer

Yes

No

0

0 / 10 / 20 ...

top

integer

Yes

No

0

0 / 10 / 20 ...

extractAnchor

text

string

Yes

Yes

n/a

Signature of the Client

anchorPoint

string

Yes

Yes

n/a

TOPLEFT / TOPRIGHT / BOTTOMLEFT / BOTTOMRIGHT

index

integer

Yes

No

0

0 / 1 / 2 ...

width

integer

Yes

No

200

150

characterIndex

integer

Yes

No

0

0

height

integer

Yes

No

50

40

leftOffset

integer

Yes

No

0

40

rightOffset

integer

Yes

No

0

-10

roles

id

string

Yes

No

n/a

client

index

integer

Yes

No

0

1 / 2 / 3 ...

name

string

Yes

No

n/a

client

type

string

Yes

No

SIGNER

SIGNER / SENDER

signers

email

string

Yes

Yes

n/a

john.smith@example.com

firstName

string

Yes

Yes

n/a

John

lastName

string

Yes

Yes

n/a

Smith

id

string

Yes

No

n/a

client

APEX SDK

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.


Cet article vous a-t-il été utile ?

Changing your password will log you out immediately. Use the new password to log back in.
First name must have atleast 2 characters. Numbers and special characters are not allowed.
Last name must have atleast 1 characters. Numbers and special characters are not allowed.
Enter a valid email
Enter a valid password
Your profile has been successfully updated.
ESC

Eddy AI, facilitant la découverte de connaissances grâce à l’intelligence conversationnelle