Replace Fillable Fields with BoldSign Fields

BoldSign supports automatic detection of form fields within fillable documents. By setting the AutoDetectFields property to true during document creation, BoldSign can identify and replace fillable fields with corresponding BoldSign form fields. The auto-detection feature supports text boxes, checkboxes, radio buttons, dropdowns, and signature fields.

Here are some code examples that illustrate how to detect fillable fields in a document and automatically replace them with BoldSign form fields when sending the document through the API.

curl -X 'POST' \
  'https://api.boldsign.com/v1/document/send' \
  -H 'accept: application/json' \
  -H 'X-API-KEY: {your API key}' \
  -H 'Content-Type: multipart/form-data' \
  -F 'AutoDetectFields=true' \
  -F 'Title="Sample Document"' \
  -F 'Signers={
  "name": "hanky",
  "emailAddress": "[email protected]",
  "signerType": "Signer",
  "locale": "EN"
}' \
  -F 'Files=@{your file}' \
var apiClient = new ApiClient("https://api.boldsign.com", "{Your API key}");
var documentClient = new DocumentClient(apiClient);

var documentFilePath = new DocumentFilePath
{
    ContentType = "application/pdf",
    FilePath = "{Your File path}"
};

var filesToUpload = new List<IDocumentFile>
{
    documentFilePath,
};

var signer = new DocumentSigner(
    signerName: "David",
    signerType: SignerType.Signer,
    signerEmail: "[email protected]",
    locale: Locales.EN);

var documentSigners = new List<DocumentSigner>()
{
    signer
};

var sendForSign = new SendForSign()
{
    Signers = documentSigners,
    Title = "Sample Document",
    AutoDetectFields = true,
    Files = filesToUpload
};
var documentCreated = documentClient.SendDocument(sendForSign);
import boldsign

configuration = boldsign.Configuration(host = "https://api.boldsign.com", api_key = "YOUR_API_KEY")

with boldsign.ApiClient(configuration) as api_client:
    
    document_api = boldsign.DocumentApi(api_client)
    
    send_for_sign = boldsign.SendForSign(
        title = "Document SDK API",
        document_title = "SDK Document Test case",
        description = "Testing document from SDK integration test case",
        files = ["YOUR_FILE_PATH"],
        signers = [
            boldsign.DocumentSigner(
                name = "hanky",
                emailAddress = "[email protected]",
                signerOrder = 1,
                signerType = "Signer",
            )
        ],
        AutoDetectFields = True
    )
    
    document_created = document_api.send_document(send_for_sign)
<?php require_once "vendor/autoload.php";

use BoldSign\Configuration;
use BoldSign\Api\DocumentApi;
use BoldSign\Model\{DocumentSigner, SendForSign, DocumentInfo, FileInfo};

$config = new Configuration();
$config->setHost('https://api.boldsign.com');
$config->setApiKey('YOUR_API_KEY');

$document_api = new DocumentApi($config);

$document_signer = new DocumentSigner();
$document_signer->setName('hanky');
$document_signer->setEmailAddress('[email protected]');
$document_signer->setSignerType('Signer');
$document_signer->setSignerOrder(1);

$send_for_sign = new SendForSign();

$documentInfo = new DocumentInfo();
$documentInfo->setTitle('Document SDK API');
$documentInfo->setDescription('Testing document from SDK integration test case');
$send_for_sign->setDocumentInfo([$documentInfo]);

$files = new FileInfo();
$files = 'YOUR_FILE_PATH';
$send_for_sign->setFiles([$files]);

$send_for_sign->setTitle('SDK Document Test case');
$send_for_sign->setSigners([$document_signer]);
$send_for_sign->setAutoDetectFields(true);

$document_created = $document_api->sendDocument($send_for_sign);
ApiClient client = Configuration.getDefaultApiClient();
client.setBasePath("https://api.boldsign.com");
client.setApiKey("YOUR_API_KEY");

DocumentApi documentApi = new DocumentApi(client);

DocumentSigner signer = new DocumentSigner();
signer.setName("hanky");
signer.setEmailAddress("[email protected]");
signer.setSignerOrder(1);
signer.setSignerType(DocumentSigner.SignerTypeEnum.SIGNER);

SendForSign sendForSign = new SendForSign();

File file = new File("YOUR_FILE_PATH");  
sendForSign.setFiles(Arrays.asList(file));

sendForSign.setTitle("SDK Document Test case");
sendForSign.setSigners(Arrays.asList(signer));
sendForSign.setAutoDetectFields(true);

DocumentCreated documentCreated = documentApi.sendDocument(sendForSign);
import { DocumentApi, DocumentSigner, DocumentInfo, FormField, Rectangle, SendForSign } from "boldsign"; 
import * as fs from 'fs';

const documentApi = new DocumentApi("https://api.boldsign.com");
documentApi.setApiKey("YOUR_API_KEY");

const documentSigner = new DocumentSigner();
documentSigner.name = "David";
documentSigner.emailAddress = "[email protected]";
documentSigner.signerOrder = 1;
documentSigner.signerType = DocumentSigner.SignerTypeEnum.Signer;

const files = fs.createReadStream("YOUR_FILE_PATH");

const sendForSign = new SendForSign();

const documentInfo = new DocumentInfo();
documentInfo.title = "SDK Document Test case";
documentInfo.description = "Testing document from SDK integration test case";
sendForSign.documentInfo = [documentInfo];

sendForSign.title = "Document SDK API";
sendForSign.signers = [documentSigner];
sendForSign.files = [files];
sendForSign.autoDetectFields = true;

const documentCreated = documentApi.sendDocument(sendForSign);

In the examples provided above, please ensure that the AutoDetectFields option is set to true. This will automatically detect fillable fields within the document and replace them with BoldSign form fields when the document is sent to the signer.