BoldSign Site Logo

Dynamic field positioning with text tags

BoldSign text tags are used to place the form field in the document without using co-ordinates, this will be used in the scenario when form field’s location is not predictable, due to the document content nature.
Info-icon In this demo sample, we have used black color text for your visibility and to understand about text tags. But in real, it is advised to use the color that match background, usually it will be white-on-white.
Step 1: On the form submission, create the new document using Send document API. It will return the document Id which we can use to generate the embedded signing link.
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 'Signers={ "name": "hanky", "emailAddress": "[email protected]", "signerType": "Signer", "formFields": [ { "id": "Image", "name": "Image", "fieldType": "Image", "pageNumber": 1, "isRequired": true, "bounds": { "x": 200, "y": 200, "width": 125, "height": 25 }, "imageInfo": { "title": "Add Image", "description": "Image Description", "allowedFileExtensions": ".jpg, .png" } } ], "locale": "EN" }' \
  -F 'Files=@{your file}' \
  -F 'Title=Invitation form'
var apiClient = new ApiClient("https://api.boldsign.com", "Your_API_Key");

var documentClient = new DocumentClient(apiClient);

List<FormField> formField = new List<FormField>
{
    new FormField(
        id: "Signature",
        type: FieldType.Signature,
        pageNumber: 1,
        bounds: new Rectangle(x: 50, y: 50, width: 200, height: 30))
};

var documentDetails = new SendForSign
{
    Title = "Agreement",
    Signers = new List<DocumentSigner>
    {
        new DocumentSigner(
            signerName: "David",
            signerType: SignerType.Signer,
            signerEmail: "[email protected]",
            formFields: formField)
    },
    Files = new List<IDocumentFile>
    {
        new DocumentFilePath
        {
            ContentType = "application/pdf",
            FilePath = "YOUR_FILE_PATH",
        }
    },
};

var documentCreated = documentClient.SendDocument(documentDetails);
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)

    form_field = boldsign.FormField(
        fieldType="Signature",
        pageNumber=1,
        bounds=boldsign.Rectangle(x=50, y=50, width=200, height=25))

    document_signer = boldsign.DocumentSigner(
        name="David",
        emailAddress="[email protected]",
        signerType="Signer",
        formFields=[form_field])

    send_for_sign = boldsign.SendForSign(
        title="Document SDK API",
        files="YOUR_FILE_PATH",
        signers=[document_signer])

    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\FormField;
use BoldSign\Model\Rectangle;
use BoldSign\Model\DocumentSigner;
use BoldSign\Model\SendForSign;
use BoldSign\Model\FileInfo;

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

$document_api = new DocumentApi($config);

$form_field = new FormField();
$form_field->setFieldType('Signature');
$form_field->setPageNumber(1);
$form_field->setBounds(new Rectangle([50, 50, 200, 30]));

$signer = new DocumentSigner();
$signer->setName('David');
$signer->setEmailAddress('[email protected]');
$signer->setSignerType('Signer');
$signer->setFormFields([$form_field]);

$send_for_sign = new SendForSign();
$send_for_sign->setTitle('Document SDK API');
$files = new FileInfo();
$files = 'Your-File-Path';
$send_for_sign->setFiles([$files]);
$send_for_sign->setSigners([$signer]);

$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);

FormField signatureField = new FormField();
signatureField.setFieldType(FormField.FieldTypeEnum.SIGNATURE);
signatureField.setPageNumber(1);
Rectangle bounds = new Rectangle().x(100f).y(100f).width(100f).height(50f);
signatureField.setBounds(bounds);

DocumentSigner signer = new DocumentSigner();
signer.setName("David");
signer.setEmailAddress("[email protected]");
signer.setSignerType(DocumentSigner.SignerTypeEnum.SIGNER);
signer.setFormFields(Arrays.asList(signatureField));

SendForSign sendForSign = new SendForSign();
File file = new File("YOUR_FILE_PATH");
sendForSign.setFiles(Arrays.asList(file));
sendForSign.setSigners(Arrays.asList(signer));
sendForSign.setTitle("Document SDK API");

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

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

const bounds = new Rectangle();
bounds.x = 100;
bounds.y = 50;
bounds.width = 100;
bounds.height = 100;
const formField = new FormField();
formField.fieldType = FormField.FieldTypeEnum.Signature;
formField.pageNumber = 1;
formField.bounds = bounds;

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

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

const sendForSign = new SendForSign();
sendForSign.title = "Agreement";
sendForSign.signers = [documentSigner];
sendForSign.files = [files];

const documentCreated = documentApi.sendDocument(sendForSign);
Step 2: Use the following code by updating the received document ID from the previous step to generate the embedded signing URL.
curl -X GET 'https://api.boldsign.com/v1/document/getEmbeddedSignLink?documentId=YOUR_DOCUMENT_ID&signerEmail=Enter Signer Email&redirectUrl=Your Redirect URL' \
  -H 'X-API-KEY: YOUR_API_KEY'
var apiClient = new ApiClient("https://api.boldsign.com", "Your_API_Key");

var documentClient = new DocumentClient(apiClient);

var embeddedSigningLink = documentClient.GetEmbeddedSignLink("YOUR_DOCUMENT_ID", "Enter Signer Email", redirectUrl: "Your Redirect URL");
var signLink = embeddedSigningLink.SignLink;
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)

    document_id = "YOUR_DOCUMENT_ID"
    signing_email = "Enter Signer Email"

    embedded_signing_link = document_api.get_embedded_sign_link(
        document_id=document_id,
        signer_email=signing_email,
        redirect_url="Your Redirect URL"
    )
<?php

require_once "vendor/autoload.php";

use BoldSign\Configuration;
use BoldSign\Api\DocumentApi;

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

$document_id = 'YOUR_DOCUMENT_ID';
$signer_email = 'Enter Signer Email';
$redirect_url = 'Your Redirect URL';

$embedded_signing_link = $document_api->getEmbeddedSignLink($document_id, $signer_email, null, null, null, $redirect_url);
ApiClient client = Configuration.getDefaultApiClient();
client.setBasePath("https://api.boldsign.com");
client.setApiKey("YOUR_API_KEY");

DocumentApi documentApi = new DocumentApi(client);

String documentId = "YOUR_DOCUMENT_ID";
String signerEmail = "Enter Signer Email";
String redirectUrl = "Your redirect url";

EmbeddedSigningLink embeddedSigningLink = documentApi.getEmbeddedSignLink(documentId, signerEmail, null, null, null, new URI(redirectUrl));
import { DocumentApi } from "boldsign";

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

const documentId = "YOUR_DOCUMENT_ID";
const signerEmail = "Enter Signer Email";
const redirectUrl = "your redirect url";

const embeddedSigningLink = documentApi.getEmbeddedSignLink(documentId, signerEmail, null, null, null, redirectUrl);