To download the full code sample see our Code Share site. The PDF used in this topic can be found here. You can also see this feature in our Interactive Demo.

While this topic describes how to inject text fields into a document, the same procedure can be used to inject any type of unbound field. For more information on the types of unbound fields that are available, see Form Building Fields.

If you need a comparison to the basic object creation procedure, or if this is the first time creating a transaction, see Creating and Sending a Transaction.

The sample code below shows you how to edit the document block for injecting text fields. The withName() method is used to input the name of the PDF form field you want to inject text into, as it is named in your PDF form. The withValue() method is used as the text you want to stamp on your document.

 .withDocument(DocumentBuilder.newDocumentWithName("Sample Contract")   .enableExtraction()   .fromStream(fs, DocumentType.PDF)   .withInjectedField(FieldBuilder.textField()   .withName("Text1")   .withValue("200 E MAIN ST, PHOENIX AZ, 85123 USA"))   .withInjectedField(FieldBuilder.textField()   .withName("Text2")   .withValue("Lawn mower"))   .withInjectedField(FieldBuilder.textField()   .withName("Text3")   .withValue("Fertilizer"))   .withInjectedField(FieldBuilder.textField()   .withName("Text4")   .withValue("100"))   .withInjectedField(FieldBuilder.textField()   .withName("Text5")   .withValue("12 12 12"))) 

Results

Once you have run your code, your text fields will appear in your transaction's documents.

To download the full code sample see our Code Share site. The PDF used in this topic can be found here. You can also see this feature in our Interactive Demo.

While this topic describes how to inject text fields into a document, the same procedure can be used to inject any type of unbound field. For more information on the types of unbound fields that are available, see Form Building Fields.

If you need a comparison to the basic object creation procedure, or if this is the first time creating a transaction, see Creating and Sending a Transaction.

The sample code below shows you how to edit the document block for injecting text fields. The withName() method is used to input the name of the PDF form field you want to inject text into, as it is named in your PDF form. The withValue() method is used as the text you want to stamp on your document.

 .WithDocument(DocumentBuilder.NewDocumentNamed("sample contract")   .EnableExtraction()   .FromStream(fs, DocumentType.PDF)   .WithInjectedField(FieldBuilder.TextField()   .WithId("Text1")   .WithName("Text1")   .WithValue("200 E MAIN ST, PHOENIX AZ, 85123 USA"))   .WithInjectedField(FieldBuilder.TextField()   .WithId("Text2")   .WithName("Text2")   .WithValue("Lawn mower"))   .WithInjectedField(FieldBuilder.TextField()   .WithId("Text3")   .WithName("Text3")   .WithValue("Fertilizer"))   .WithInjectedField(FieldBuilder.TextField()   .WithId("Text4")   .WithName("Text4")   .WithValue("100"))   .WithInjectedField(FieldBuilder.TextField()   .WithId("Text5")   .WithName("Text5")   .WithValue("12 12 12")) 

Results

Once you have run your code, your text fields will appear in your transaction's documents.

To download the full code sample see our Code Share site. The PDF used in this topic can be found here. You can also see this feature in our Interactive Demo.

While this topic describes how to inject text fields into a document, the same procedure can be used to inject any type of unbound field. For more information on the types of unbound fields that are available, see Form Building Fields.

If you need a comparison to the basic object creation procedure, or if this is the first time creating a transaction, see Creating and Sending a Transaction.

The sample code below shows you how to edit the document block for injecting text fields. The withName() method is used to input the name of the PDF form field you want to inject text into, as it is named in your PDF form. The withValue() method is used as the text you want to stamp on your document.

The sample JSON below shows you how to edit the document object for injecting text fields.I n the fields object, the name attribute is the name of the PDF form field you want to inject text into. The value attribute is where you input the text you want to inject on your document. .

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" {
    "documents": [{
        "fields": [{
            "value": "200 E MAIN ST, PHOENIX AZ, 85123 USA",
            "name": "Text1"
        }, {
            "value": "Lawn mower",
            "name": "Text2"
        }, {
            "value": "Fertilizer",
            "name": "Text3"
        }, {
            "value": "100",
            "name": "Text4"
        }, {
            "value": "12 12 12",
            "name": "Text5"
        }],
        "extract": true,
        "name": "Sample Contract"
    }],
    "type": "PACKAGE",
    "status": "DRAFT",
    "roles": [{
        "id": "client",
        "index": 0,
        "type": "SIGNER",
        "signers": [{
            "email": "[email protected]",
            "firstName": "John",
            "lastName": "Smith",
            "id": "client"
        }],
        "name": "client"
    }, {
        "id": "contractor",
        "index": 1,
        "type": "SENDER",
        "signers": [{
            "email": "[email protected]",
            "firstName": "Haris",
            "lastName": "Haidary",
            "id": "contractor"
        }],
        "name": "contractor"
    }],
    "name": "Field Injection Example"
}-- -- --WebKitFormBoundary1bNO60n7FqP5WO4t--

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

Response Payload

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

Results

Once you have run your code, your text fields will appear in your transaction's documents.

Request Payload Table

PropertyTypeEditableRequiredDefaultSample Values
statusstringYesNoDRAFTDRAFT / SENT / COMPLETED / ARCHIVED / DECLINED / OPTED_OUT / EXPIRED
typestringYesNoPACKAGEPACKAGE / TEMPLATE / LAYOUT
namestringYesYesn/aField Injection Example
documents
namestringYesNon/aSample Contract
extractbooleanYesNofalsefalse / true
fields
valuestringYesNon/a200 E MAIN ST, PHOENIX AZ, 85123 USA
namestringYesNon/aText1
roles
idstringYesNon/aClient1
namestringYesNon/aClient1
typestringYesNoSIGNERSIGNER / SENDER
signers
emailstringYesYesn/a[email protected]
firstNamestringYesYesn/aJohn
lastNamestringYesYesn/aSmith
phonestringYesNon/a514-555-8888
idstringYesNon/aClient1
companystringYesNon/aAcme Inc.
titlestringYesNon/aManaging Director

To download the full code sample see our Code Share site. The PDF used in this topic can be found here. You can also see this feature in our Interactive Demo.

While this topic describes how to inject text fields into a document, the same procedure can be used to inject any type of unbound field. For more information on the types of unbound fields that are available, see Form Building Fields.

If you need a comparison to the basic object creation procedure, or if this is the first time creating a transaction, see Creating and Sending a Transaction.

The sample code below shows you how to build the Document object for injecting text fields. The name attribute of field is where you input the name of your PDF form field you want to inject text to. The value attribute of field is the text you want to stamp on your document.

  String documentId = 'document1';   StaticResource sr = [SELECT Id, Body FROM StaticResource WHERE Name = 'test_field_injection' LIMIT 1];   Map<String,Blob> doc = new Map<String,Blob>();   doc.put(documentId, sr.Body);   ESignLiveAPIObjects.Document document = new ESignLiveAPIObjects.Document();   document.name = documentId;   document.id = documentId;   document.extract = true;   //set field injection   ESignLiveAPIObjects.Field field1 = new ESignLiveAPIObjects.Field();   field1.name = 'Text1';   field1.value = '200 E MAIN ST, PHOENIX AZ, 85123 USA';   ESignLiveAPIObjects.Field field2 = new ESignLiveAPIObjects.Field();   field2.name = 'Text2';   field2.value = 'Lawn mower';   ESignLiveAPIObjects.Field field3 = new ESignLiveAPIObjects.Field();   field3.name = 'Text3';   field3.value = 'Fertilizer';   ESignLiveAPIObjects.Field field4 = new ESignLiveAPIObjects.Field();   field4.name = 'Text4';   field4.value = '100';   ESignLiveAPIObjects.Field field5 = new ESignLiveAPIObjects.Field();   field5.name = 'Text5';   field5.value = '12 12 12';   document.fields = new List<ESignLiveAPIObjects.Field>{field1,field2,field3,field4,field5};   sdk.createDocuments(packageId, document, doc); 

Results

Once you have run your code, your text fields will appear in your transaction's documents.