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

Templates and Layouts fulfill the same goal of automating the e-signature process by shortening the time it takes to send documents that include several signature blocks and data fields. Templates are ideal to use at the transaction level – you can pre-define your signers, documents, signature locations and e-signature workflows to streamline the e-signature process. A Layout on the other hand, is a type of template that allows you to create pre-defined locations for your signature blocks and data fields within a document. It acts like a ‘marker’ where signature blocks and data fields will sit in the document. Layouts are helpful for users who frequently send forms that may be slightly different per recipient but signature blocks and data fields remain in the same location throughout the document. What’s more, you can use multiple Layouts per document, and apply them to individual pages within your transaction.

Finding your Layouts in the UI

When editing documents, you will find all of your saved layouts under the toolbar, as shown below. Note that layouts can only be applied when transaction are in a Draft status.

Capture

Creating a New Layout

In this example, document extraction is used to extract the fields and save them as a layout. For more information, see Document Extraction.

After creating your transaction, use the OneSpan Sign LayoutService to create a layout from your transaction. It is important to note that the Layout ID is required to apply layouts to documents. The following code will do this:

 String layoutId = eslClient.getLayoutService().createLayout(myPackage);   System.out.println(layoutId); 

Retrieving a Layout

The following code will retrieve a layout. The first step is to retrieve the layouts from the first page. In this example, five layouts are retrieved, but you can set this to any number.

 List<DocumentPackage> layouts = eslClient.getLayoutService().getLayouts(Direction.DESCENDING, new PageRequest(i, 5));   while (!layouts.isEmpty()) {   // 

Next, you will create your iterator object. This will enable you to iterate through your list of layouts.

Iterator<DocumentPackage> index = layouts.iterator();   while (index.hasNext()) {   

Then, retrieve your layout name and id.

DocumentPackage myLayout = index.next();   System.out.println(myLayout.getName() + " " + myLayout.getId());   i++;   }   //    

Use the following code to retrieve layouts from each page in the transaction, repeating for every page:

layouts = eslClient.getLayoutService().getLayouts(Direction.DESCENDING, new PageRequest(i, 5));   } 

Applying Layouts

Use the OneSpan Sign LayoutService to apply layouts, by either Layout ID, or by name.

eslClient.getLayoutService().applyLayout(packageId, "documentId", "layoutId");   
eslClient.getLayoutService().applyLayoutByName(packageId, "documentId", "layoutName");  

Deleting a Layout

To delete a layout, use the PackageService(). The following code will do this:

 eslClient.getPackageService().deletePackage(new PackageId("layoutId")); 

Results

After running your code, you will see a list of all your layouts under the toolbar. Once your layout is saved, you can then apply it on subsequent documents.

Capture

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

Templates and Layouts fulfill the same goal of automating the e-signature process by shortening the time it takes to send documents that include several signature blocks and data fields. Templates are ideal to use at the transaction level – you can pre-define your signers, documents, signature locations and e-signature workflows to streamline the e-signature process. A Layout on the other hand, is a type of template that allows you to create pre-defined locations for your signature blocks and data fields within a document. It acts like a ‘marker’ where signature blocks and data fields will sit in the document. Layouts are helpful for users who frequently send forms that may be slightly different per recipient but signature blocks and data fields remain in the same location throughout the document. What’s more, you can use multiple Layouts per document, and apply them to individual pages within your transaction.

Finding your Layouts in the UI

When editing documents, you will find all of your saved layouts under the toolbar, as shown below. Note that layouts can only be applied when transaction are in a Draft status.

Capture

Creating a New Layout

In this example, document extraction is used to extract the fields and save them as a layout. For more information, see Document Extraction.

After creating your transaction, use the OneSpan Sign LayoutService to create a layout from your transaction. It is important to note that the Layout ID is required to apply layouts to documents. The following code will do this:

 string layoutId = eslClient.LayoutService.CreateLayout(packageFromLayout);   Debug.WriteLine(layoutId); 

Retrieving a Layout

The following code will retrieve a layout. The first step is to retrieve the layouts from the first page. In this example, five layouts are retrieved, but you can set this to any number.

 List<DocumentPackage> layouts = eslClient.getLayoutService().getLayouts(Direction.DESCENDING, new PageRequest(i, 5));   while (!layouts.isEmpty()) {   // 

Next, you will create your iterator object. This will enable you to iterate through your list of layouts.

Iterator<DocumentPackage> index = layouts.iterator();   while (index.hasNext()) {   

Then, retrieve your layout name and id.

DocumentPackage myLayout = index.next();   System.out.println(myLayout.getName() + " " + myLayout.getId());   i++;   }   //    

Use the following code to retrieve layouts from each page in the transaction, repeating for every page:

Applying Layouts

Use the OneSpan Sign LayoutService to apply layouts, by either Layout ID, or by name.

eslClient.getLayoutService().applyLayout(packageId, "documentId", "layoutId");   
eslClient.getLayoutService().applyLayoutByName(packageId, "documentId", "layoutName");  

Deleting a Layout

To delete a layout, use the PackageService(). The following code will do this:

 eslClient.PackageService.DeletePackage(new PackageId("layoutId")); 

Results

After running your code, you will see a list of all your layouts under the toolbar. Once your layout is saved, you can then apply it on subsequent documents.

Capture

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

Templates and Layouts fulfill the same goal of automating the e-signature process by shortening the time it takes to send documents that include several signature blocks and data fields. Templates are ideal to use at the transaction level – you can pre-define your signers, documents, signature locations and e-signature workflows to streamline the e-signature process. A Layout on the other hand, is a type of template that allows you to create pre-defined locations for your signature blocks and data fields within a document. It acts like a ‘marker’ where signature blocks and data fields will sit in the document. Layouts are helpful for users who frequently send forms that may be slightly different per recipient but signature blocks and data fields remain in the same location throughout the document. What’s more, you can use multiple Layouts per document, and apply them to individual pages within your transaction.

Finding your Layouts in the UI

When editing documents, you will find all of your saved layouts under the toolbar, as shown below. Note that layouts can only be applied when transaction are in a Draft status.

Capture

Creating a New Layout

In this example, document extraction is used to extract the fields and save them as a layout. For more information, see Document Extraction.

Use the following code to create a layout from a document:

HTTP Request

POST /api/layouts

HTTP Headers

Accept: application/json   
Content-Type: application/json   
Authorization: Basic api_key 

Request Payload

 {   "name":"Layout 02",   "type":"LAYOUT",   "id":"packageId",   "visibility":"SENDER",   "documents":[   {   "id":"documentId"   }   ]   } 

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

Response Payload

 {   "roles": [   {   "id": "bjyxbrypiHw6",   "data": null,   "emailMessage": null,   "attachmentRequirements": [],   "locked": false,   "reassign": false,   "specialTypes": [],   "type": "SENDER",   "index": 0,   "signers": [   {   "group": null,   "language": "en",   "signature": {   "handdrawn": "AQAAADJI+a4cnf0t3Dlf0GqWJceCA+4AAwADAN8BAAADAAAAggPuAOgAAAACfyxAUkAlQCdAOUA6QDtAHEAtQBtACkAJQBVAFBIyfkA0QBVABkAYQCpAHEAtQC9ALkAtQDxAO0A6QEhAN0AlQCQyTjZAgEBwQIBAoFDSUOFQ8lDiUNJQ0lCiQHBAUCIXGVBSUCVQN1BJUDpQXVA9UE5QLlAuUDpQOVAkm1BhQLZAd0B7QFpAXUBPQTBAHkAdQAtAB2AmYBRgQmCAcJVwmHC5Mh42QFBAkECAQKBAsEDAQNBQ8VDyUPJQ81DTULRQg1ByUEGeIgQ6QDhAJ0AmQCZAFItwbHBtMhdBUCafUGJQcVCSUJFQoUDAQKBAsECBQHNAdEBEQDRABkAFYCdgR2BXYHhgd2CIYIVgdmBDYEJAUUBwQIFAkECwQLBA0EDAQLBAoEBwQGASG0xAc0BnQEhASkArQBxADEAKQAlABkAFMkVKUENQUVBBUGFQYVCRUKJQsVDCUNJQsUDQQKBAkEBwQFJAREAlIllVUHFQUVByUKFQslDSUNJQ9VDlUPZQ1lDWUKVQZVBEUCQyCxivr2BjYGRgdGB1YHZgZmBWYEdgRkAFQClAREBjQJNAk0CzQKNAs0CjQJNAQo9gRWBjYJNgs2DCYNRg1GCkYKRgY2Bkrg==",   "textual": null   },   "id": "8ceWLxUo1Gg1",   "delivery": {   "provider": false,   "email": true,   "download": true   },   "knowledgeBasedAuthentication": null,   "auth": {   "scheme": "NONE",   "challenges": []   },   "data": null,   "title": "Silanis",   "external": null,   "updated": "2017-11-14T20:31:34Z",   "phone": "",   "professionalIdentityFields": [],   "userCustomFields": [],   "company": "Silanis",   "email": "[email protected]",   "firstName": "Haris",   "lastName": "Haidary",   "name": "",   "address": null,   "created": "2017-11-14T20:31:34Z",   "specialTypes": []   }   ],   "name": "Owner"   },   {   "id": "a3bfe56c-da0a-4ff0-bfef-efe55fd28a0c",   "data": null,   "emailMessage": {   "content": ""   },   "attachmentRequirements": [],   "locked": false,   "reassign": false,   "specialTypes": [],   "type": "SIGNER",   "index": 0,   "signers": [],   "name": "Signer1"   },   {   "id": "564fd009-7673-4a5f-9314-5c5b3d5f3869",   "data": null,   "emailMessage": {   "content": ""   },   "attachmentRequirements": [],   "locked": false,   "reassign": false,   "specialTypes": [],   "type": "SIGNER",   "index": 0,   "signers": [],   "name": "Signer2"   }   ],   "status": "DRAFT",   "description": "",   "language": "en",   "id": "rr8lE3YwF-LaCNxSjntn2udM8hc=",   "data": {   "origin": "api"   },   "autocomplete": true,   "documents": [   {   "status": "",   "description": "",   "id": "dfe8ac46006b31f6",   "signedHash": null,   "extractionTypes": [],   "signerVerificationToken": null,   "data": {   "ese_document_texttag_extract_needed": "false"   },   "approvals": [   {   "id": "akmT717La0YP",   "role": "a3bfe56c-da0a-4ff0-bfef-efe55fd28a0c",   "data": null,   "signed": null,   "accepted": null,   "fields": [   {   "binding": null,   "validation": null,   "id": "AooaSEwkp0oG",   "page": 0,   "data": null,   "subtype": "FULLNAME",   "height": 40,   "extract": false,   "width": 200,   "extractAnchor": null,   "left": 94,   "top": 752,   "type": "SIGNATURE",   "value": "",   "name": "AooaSEwkp0oG"   }   ],   "name": "AooaSEwkp0oG"   },   {   "id": "anR9R3fLlQYE",   "role": "564fd009-7673-4a5f-9314-5c5b3d5f3869",   "data": null,   "signed": null,   "accepted": null,   "fields": [   {   "binding": null,   "validation": null,   "id": "AvqDbyKBeIoX",   "page": 0,   "data": null,   "subtype": "FULLNAME",   "height": 40,   "extract": false,   "width": 200,   "extractAnchor": null,   "left": 94,   "top": 833,   "type": "SIGNATURE",   "value": "",   "name": "AvqDbyKBeIoX"   }   ],   "name": "AvqDbyKBeIoX"   }   ],   "pages": [   {   "id": "",   "height": 1030,   "width": 796,   "left": 0,   "top": 0,   "version": 0,   "index": 0   }   ],   "external": null,   "extract": false,   "fields": [],   "index": 0,   "name": "cleaning_contract",   "size": 197171   }   ],   "sender": {   "status": "ACTIVE",   "language": "en",   "signature": {   "handdrawn": "AQAAADJI+a4cnf0t3Dlf0GqWJceCA+4AAwADAN8BAAADAAAAggPuAOgAAAACfyxAUkAlQCdAOUA6QDtAHEAtQBtACkAJQBVAFBIyfkA0QBVABkAYQCpAHEAtQC9ALkAtQDxAO0A6QEhAN0AlQCQyTjZAgEBwQIBAoFDSUOFQ8lDiUNJQ0lCiQHBAUCIXGVBSUCVQN1BJUDpQXVA9UE5QLlAuUDpQOVAkm1BhQLZAd0B7QFpAXUBPQTBAHkAdQAtAB2AmYBRgQmCAcJVwmHC5Mh42QFBAkECAQKBAsEDAQNBQ8VDyUPJQ81DTULRQg1ByUEGeIgQ6QDhAJ0AmQCZAFItwbHBtMhdBUCafUGJQcVCSUJFQoUDAQKBAsECBQHNAdEBEQDRABkAFYCdgR2BXYHhgd2CIYIVgdmBDYEJAUUBwQIFAkECwQLBA0EDAQLBAoEBwQGASG0xAc0BnQEhASkArQBxADEAKQAlABkAFMkVKUENQUVBBUGFQYVCRUKJQsVDCUNJQsUDQQKBAkEBwQFJAREAlIllVUHFQUVByUKFQslDSUNJQ9VDlUPZQ1lDWUKVQZVBEUCQyCxivr2BjYGRgdGB1YHZgZmBWYEdgRkAFQClAREBjQJNAk0CzQKNAs0CjQJNAQo9gRWBjYJNgs2DCYNRg1GCkYKRgY2Bkrg==",   "textual": null   },   "id": "ZQI8k6faVoM8",   "data": {   "serviceCredentials": "{}",   "showIntro": false   },   "account": null,   "title": null,   "external": null,   "updated": "2016-05-05T19:30:13Z",   "memberships": [],   "phone": "+1 201-555-5555",   "professionalIdentityFields": [],   "userCustomFields": [   {   "id": "policy_number_id",   "data": null,   "translations": [   {   "description": "Car Insurance Policy Number.",   "language": "en",   "id": "",   "data": null,   "name": "Policy Number"   }   ],   "value": "",   "name": ""   }   ],   "locked": null,   "activated": null,   "company": "eSignLive",   "email": "[email protected]",   "firstName": "Haris",   "lastName": "Haidary",   "type": "MANAGER",   "name": "",   "address": null,   "created": "2016-05-05T19:30:13Z",   "specialTypes": [],   "hasDelegates": false   },   "emailMessage": "",   "limits": null,   "notarized": false,   "notaryRoleId": null,   "settings": {   "ceremony": {   "layout": {   "header": {   "feedback": true,   "titleBar": null,   "breadcrumbs": true,   "globalActions": {   "confirm": true,   "download": true,   "hideEvidenceSummary": true,   "saveAsLayout": true   },   "globalNavigation": true,   "sessionBar": true   },   "footer": null,   "brandingBar": {   "logo": {   "link": "",   "src": "branding"   }   },   "iframe": false,   "navigator": true   },   "style": null,   "enforceCaptureSignature": false,   "events": {   "complete": {   "redirect": null,   "dialog": true   }   },   "extractAcroFields": true,   "extractTextTags": true,   "inPerson": false,   "declineButton": true,   "declineReasons": [],   "disableDeclineOther": false,   "disableDownloadForUncompletedPackage": false,   "disableFirstInPersonAffidavit": false,   "disableInPersonAffidavit": false,   "disableOptOutOther": false,   "disableSecondInPersonAffidavit": false,   "documentToolbarOptions": null,   "handOver": null,   "hideCaptureText": false,   "hideLanguageDropdown": false,   "hidePackageOwnerInPerson": false,   "hideWatermark": false,   "maxAuthFailsAllowed": 3,   "optOutButton": true,   "optOutReasons": []   }   },   "signedDocumentDelivery": null,   "trashed": false,   "updated": "2017-11-14T20:31:34Z",   "completed": null,   "consent": null,   "due": null,   "visibility": "SENDER",   "type": "LAYOUT",   "messages": [],   "name": "cleaning_contract",   "created": "2017-11-14T20:31:34Z",   "bulkSendable": true   } 

It is important to note that theLayout ID is required to apply layouts to documents.

Retrieving a Layout

You can also retrieve all of your saved layouts. The following code will do this:

HTTP Request

GET /api/layouts?from={fromPage}&to={toPage}

HTTP Headers

Accept: application/json   
Content-Type: application/json   
Authorization: Basic api_key 

Response Payload

 {   "results": [   {   "roles": [   {   "id": "564fd009-7673-4a5f-9314-5c5b3d5f3869",   "data": null,   "emailMessage": {   "content": ""   },   "attachmentRequirements": [],   "locked": false,   "reassign": false,   "specialTypes": [],   "type": "SIGNER",   "index": 0,   "signers": [],   "name": "Signer2"   },   {   "id": "a3bfe56c-da0a-4ff0-bfef-efe55fd28a0c",   "data": null,   "emailMessage": {   "content": ""   },   "attachmentRequirements": [],   "locked": false,   "reassign": false,   "specialTypes": [],   "type": "SIGNER",   "index": 0,   "signers": [],   "name": "Signer1"   },   {   "id": "bjyxbrypiHw6",   "data": null,   "emailMessage": null,   "attachmentRequirements": [],   "locked": false,   "reassign": false,   "specialTypes": [],   "type": "SENDER",   "index": 0,   "signers": [   {   "group": null,   "language": "en",   "signature": {   "handdrawn": "AQAAADJI+a4cnf0t3Dlf0GqWJceCA+4AAwADAN8BAAADAAAAggPuAOgAAAACfyxAUkAlQCdAOUA6QDtAHEAtQBtACkAJQBVAFBIyfkA0QBVABkAYQCpAHEAtQC9ALkAtQDxAO0A6QEhAN0AlQCQyTjZAgEBwQIBAoFDSUOFQ8lDiUNJQ0lCiQHBAUCIXGVBSUCVQN1BJUDpQXVA9UE5QLlAuUDpQOVAkm1BhQLZAd0B7QFpAXUBPQTBAHkAdQAtAB2AmYBRgQmCAcJVwmHC5Mh42QFBAkECAQKBAsEDAQNBQ8VDyUPJQ81DTULRQg1ByUEGeIgQ6QDhAJ0AmQCZAFItwbHBtMhdBUCafUGJQcVCSUJFQoUDAQKBAsECBQHNAdEBEQDRABkAFYCdgR2BXYHhgd2CIYIVgdmBDYEJAUUBwQIFAkECwQLBA0EDAQLBAoEBwQGASG0xAc0BnQEhASkArQBxADEAKQAlABkAFMkVKUENQUVBBUGFQYVCRUKJQsVDCUNJQsUDQQKBAkEBwQFJAREAlIllVUHFQUVByUKFQslDSUNJQ9VDlUPZQ1lDWUKVQZVBEUCQyCxivr2BjYGRgdGB1YHZgZmBWYEdgRkAFQClAREBjQJNAk0CzQKNAs0CjQJNAQo9gRWBjYJNgs2DCYNRg1GCkYKRgY2Bkrg==",   "textual": null   },   "id": "8ceWLxUo1Gg1",   "delivery": {   "provider": false,   "email": true,   "download": true   },   "knowledgeBasedAuthentication": null,   "auth": {   "scheme": "NONE",   "challenges": []   },   "data": null,   "title": "Silanis",   "external": null,   "updated": "2017-11-14T20:31:34Z",   "phone": "",   "professionalIdentityFields": [],   "userCustomFields": [],   "company": "Silanis",   "email": "[email protected]",   "firstName": "Haris",   "lastName": "Haidary",   "name": "",   "address": null,   "created": "2017-11-14T20:31:34Z",   "specialTypes": []   }   ],   "name": "Owner"   }   ],   "status": "DRAFT",   "description": "",   "language": "en",   "id": "rr8lE3YwF-LaCNxSjntn2udM8hc=",   "data": {   "origin": "api"   },   "autocomplete": true,   "documents": [   {   "status": "",   "description": "",   "id": "dfe8ac46006b31f6",   "signedHash": null,   "extractionTypes": [],   "signerVerificationToken": null,   "data": {},   "approvals": [   {   "id": "akmT717La0YP",   "role": "a3bfe56c-da0a-4ff0-bfef-efe55fd28a0c",   "data": null,   "signed": null,   "accepted": null,   "fields": [   {   "binding": null,   "validation": null,   "id": "AooaSEwkp0oG",   "page": 0,   "data": null,   "subtype": "FULLNAME",   "height": 39.99995853281021,   "extract": false,   "width": 199.99979266405106,   "extractAnchor": null,   "left": 94.00000655210017,   "top": 752.0005724167823,   "type": "SIGNATURE",   "value": "",   "name": "AooaSEwkp0oG"   }   ],   "name": ""   },   {   "id": "anR9R3fLlQYE",   "role": "564fd009-7673-4a5f-9314-5c5b3d5f3869",   "data": null,   "signed": null,   "accepted": null,   "fields": [   {   "binding": null,   "validation": null,   "id": "AvqDbyKBeIoX",   "page": 0,   "data": null,   "subtype": "FULLNAME",   "height": 39.99995853281021,   "extract": false,   "width": 199.99979266405106,   "extractAnchor": null,   "left": 94.00000655210017,   "top": 832.999669445753,   "type": "SIGNATURE",   "value": "",   "name": "AvqDbyKBeIoX"   }   ],   "name": ""   }   ],   "pages": [   {   "id": "dfe8ac46006b31f6_0_-1_1.png",   "height": 1030,   "width": 796,   "left": 0,   "top": 0,   "version": 0,   "index": 0   }   ],   "external": null,   "extract": false,   "fields": [],   "index": 0,   "name": "cleaning_contract",   "size": 197171   }   ],   "sender": {   "status": "ACTIVE",   "language": "en",   "signature": {   "handdrawn": "AQAAADJI+a4cnf0t3Dlf0GqWJceCA+4AAwADAN8BAAADAAAAggPuAOgAAAACfyxAUkAlQCdAOUA6QDtAHEAtQBtACkAJQBVAFBIyfkA0QBVABkAYQCpAHEAtQC9ALkAtQDxAO0A6QEhAN0AlQCQyTjZAgEBwQIBAoFDSUOFQ8lDiUNJQ0lCiQHBAUCIXGVBSUCVQN1BJUDpQXVA9UE5QLlAuUDpQOVAkm1BhQLZAd0B7QFpAXUBPQTBAHkAdQAtAB2AmYBRgQmCAcJVwmHC5Mh42QFBAkECAQKBAsEDAQNBQ8VDyUPJQ81DTULRQg1ByUEGeIgQ6QDhAJ0AmQCZAFItwbHBtMhdBUCafUGJQcVCSUJFQoUDAQKBAsECBQHNAdEBEQDRABkAFYCdgR2BXYHhgd2CIYIVgdmBDYEJAUUBwQIFAkECwQLBA0EDAQLBAoEBwQGASG0xAc0BnQEhASkArQBxADEAKQAlABkAFMkVKUENQUVBBUGFQYVCRUKJQsVDCUNJQsUDQQKBAkEBwQFJAREAlIllVUHFQUVByUKFQslDSUNJQ9VDlUPZQ1lDWUKVQZVBEUCQyCxivr2BjYGRgdGB1YHZgZmBWYEdgRkAFQClAREBjQJNAk0CzQKNAs0CjQJNAQo9gRWBjYJNgs2DCYNRg1GCkYKRgY2Bkrg==",   "textual": null   },   "id": "ZQI8k6faVoM8",   "data": {   "serviceCredentials": "{}",   "showIntro": false   },   "account": {   "id": "3vD0Dc9Fh7wQ",   "data": null,   "updated": "2016-05-05T19:30:13Z",   "company": {   "id": "jVWmyg4cyis8",   "data": null,   "address": {   "address1": null,   "address2": null,   "city": null,   "country": null,   "zipcode": null,   "state": null   },   "name": "eSignLive"   },   "licenses": [   {   "status": "ACTIVE",   "paidUntil": "2020-05-05T00:00:00Z",   "plan": {   "group": "",   "description": "E-Sign Hundreds of Documents with Unlimited Signers",   "id": "sandbox",   "features": null,   "price": {   "amount": 0,   "currency": {   "id": "USD",   "data": null,   "name": "US Dollar"   }   },   "original": null,   "cycle": "YEAR",   "contract": "YEAR",   "freeCycles": null,   "quotas": [   {   "cycle": null,   "scope": "ACCOUNT",   "limit": 100,   "target": "SENDER"   },   {   "cycle": null,   "scope": "SENDER",   "limit": 500,   "target": "DOCUMENT"   },   {   "cycle": null,   "scope": "SENDER",   "limit": 500,   "target": "STORAGE"   }   ],   "data": null,   "name": "Sandbox"   },   "transactions": [],   "created": "2016-05-05T19:30:13Z"   }   ],   "logoUrl": "",   "providers": null,   "customFields": [   {   "required": false,   "id": "policy_number_id",   "data": null,   "translations": [   {   "description": "Car Insurance Policy Number.",   "language": "en",   "id": "",   "data": null,   "name": "Policy Number"   }   ],   "value": "123-456-789-0",   "name": ""   }   ],   "created": "2016-05-05T19:30:13Z",   "owner": "ZQI8k6faVoM8",   "name": "Haris Haidary"   },   "title": null,   "external": null,   "updated": "2016-05-05T19:30:13Z",   "memberships": [],   "phone": "+1 201-555-5555",   "professionalIdentityFields": [],   "userCustomFields": [   {   "id": "policy_number_id",   "data": null,   "translations": [   {   "description": "Car Insurance Policy Number.",   "language": "en",   "id": "",   "data": null,   "name": "Policy Number"   }   ],   "value": "",   "name": ""   }   ],   "locked": null,   "activated": null,   "company": "eSignLive",   "email": "[email protected]",   "firstName": "Haris",   "lastName": "Haidary",   "type": "MANAGER",   "name": "",   "address": {   "address1": "",   "address2": "",   "city": "",   "country": "",   "zipcode": "",   "state": ""   },   "created": "2016-05-05T19:30:13Z",   "specialTypes": [],   "hasDelegates": false   },   "emailMessage": "",   "limits": null,   "notarized": false,   "settings": {   "ceremony": {   "layout": {   "header": {   "feedback": true,   "titleBar": null,   "breadcrumbs": true,   "globalActions": {   "confirm": true,   "download": true,   "hideEvidenceSummary": true,   "saveAsLayout": true   },   "globalNavigation": true,   "sessionBar": true   },   "footer": null,   "brandingBar": {   "logo": {   "link": "",   "src": "branding"   }   },   "iframe": false,   "navigator": true   },   "style": null,   "enforceCaptureSignature": false,   "events": {   "complete": {   "redirect": null,   "dialog": true   }   },   "extractAcroFields": true,   "extractTextTags": true,   "inPerson": false,   "declineButton": true,   "declineReasons": [],   "disableDeclineOther": false,   "disableDownloadForUncompletedPackage": false,   "disableFirstInPersonAffidavit": false,   "disableInPersonAffidavit": false,   "disableOptOutOther": false,   "disableSecondInPersonAffidavit": false,   "documentToolbarOptions": null,   "handOver": null,   "hideCaptureText": false,   "hideLanguageDropdown": false,   "hidePackageOwnerInPerson": false,   "hideWatermark": false,   "maxAuthFailsAllowed": 3,   "optOutButton": true,   "optOutReasons": []   }   },   "signedDocumentDelivery": null,   "updated": "2017-11-14T20:31:34Z",   "consent": null,   "due": null,   "visibility": "SENDER",   "type": "LAYOUT",   "messages": [],   "name": "cleaning_contract",   "created": "2017-11-14T20:31:34Z",   "notaryRoleId": null,   "bulkSendable": false   }   ],   "count": 5   } 

Similarly, to apply a layout, you will need the packageId, documentId, and layoutId/layoutName, to make your request:

If using LayoutID:

HTTP Request

POST /api/packages/{packageId}/documents/{documentId}/layout?layoutId={layoutId}

HTTP Headers

Accept: application/json   
Content-Type: application/json   
Authorization: Basic api_key 

If using layout name:

HTTP Request

POST /api/packages/{packageId}/documents/{documentId}/layout?layoutName={layoutName}

HTTP Headers

Accept: application/json   
Content-Type: application/json   
Authorization: Basic api_key 

Deleting a Layout

To delete a layout use the following code:

HTTP Request

DELETE /api/packages/{layoutId}

HTTP Headers

Accept: application/json   
Content-Type: application/json   
Authorization: Basic api_key 

Results

After running your code, you will see a list of all your layouts under the toolbar. Once your layout is saved, you can then apply it on subsequent documents.

Capture

Request Payload Table

Property Type Editable Required Default Sample Values
type string Yes No PACKAGE PACKAGE / TEMPLATE / LAYOUT
name string Yes Yes n/a Layout Example
id string Yes No n/a rr8lE3YwF-LaCNxSjntn2udM8hc=
visibility string Yes No ACCOUNT ACCOUNT / SENDER
documents
id string Yes No n/a sample-contract

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

Templates and Layouts fulfill the same goal of automating the e-signature process by shortening the time it takes to send documents that include several signature blocks and data fields. Templates are ideal to use at the transaction level – you can pre-define your signers, documents, signature locations and e-signature workflows to streamline the e-signature process. A Layout on the other hand, is a type of template that allows you to create pre-defined locations for your signature blocks and data fields within a document. It acts like a ‘marker’ where signature blocks and data fields will sit in the document. Layouts are helpful for users who frequently send forms that may be slightly different per recipient but signature blocks and data fields remain in the same location throughout the document. What’s more, you can use multiple Layouts per document, and apply them to individual pages within your transaction.

Finding your Layouts in the UI

When editing documents, you will find all of your saved layouts under the toolbar, as shown below. Note that layouts can only be applied when transaction are in a Draft status.

Capture

Creating a New Layout

In this example, document extraction is used to extract the fields and save them as a layout. For more information, see Document Extraction.

After creating your package, use the following encapsulated function to create your layout from an existing package.

 public ESignLiveAPIObjects.package_x createLayout(string packageId, string documentId, string layoutName, TestLayout.Visibility visibility) 

It is important to note that the Layout ID is required to apply layouts to documents. The following code will do this:

  ESignLiveAPIObjects.package_x createLayout = createLayout(pkgId,'Sample_Document_Extraction','Layout Created from Apex SDK', TestLayout.Visibility.ACCOUNT);   String layoutId = createLayout.id; 

Retrieving a Layout

The following code will retrieve a layout.

  //retrieve all layouts   integer totalCount = getLayoutCount();   integer index = 0;   System.debug('Total layout count: ' + totalCount);   while(index < totalCount){   List<ESignLiveAPIObjects.package_x> layouts = getLayouts(index,index+49);   for(ESignLiveAPIObjects.package_x layout: layouts){   System.debug('Layout name: ' + layout.name + ' with id: ' + layout.id);   }   index += 50;   } 

Similarly to creating layouts, use the following encapsulated functions to apply a layout to your document. This code will pass in your layout ID, target package ID and target Document ID.

  public void applyLayout(String packageId, String documentId, String layoutId) 

Deleting a Layout

To delete a layout, use the following code:

  //delete layout   ESignLiveSDK sdk = new ESignLiveSDK();   sdk.deletePackage(layoutId); 

Results

After running your code, you will see a list of all your layouts under the toolbar. Once your layout is saved, you can then apply it on subsequent documents.

Capture