BoldSign AI Assistant
Chat with the BoldSign AI AssistantEmbed Document Creation in Your Application
Integrating embedded document creation into your application allows you to seamlessly incorporate BoldSign's document creation functionalities within your app's user interface.
When utilizing the embedded document feature, documents generated will remain in the draft state until users finalize the creation process via the provided URL.
Follow these steps to seamlessly integrate document creation into your application:
1. Customize UI for embed document request
In your application, create a user interface (UI) that allows users to input relevant information for the embedded document request. This information will be used to create the document.
For instance, collect user inputs for the following parameters:
TitleMessageSigners- Other customization options (e.g., ShowToolbar, ShowSaveButton, SendViewOption, etc.)
Here are example codes that demonstrate how to create an embedded document:
Code snippet
curl -X POST 'https://api.boldsign.com/v1/document/createEmbeddedRequestUrl' \
-H 'X-API-KEY: {your API key}' \
-F 'Title=Sent from API Curl' \
-F 'ShowToolbar=true' \
-F 'ShowNavigationButtons=true' \
-F 'ShowPreviewButton=true' \
-F 'ShowSendButton=true' \
-F 'ShowSaveButton=true' \
-F 'SendViewOption=PreparePage' \
-F 'ShowTooltip=false' \
-F 'Locale=EN' \
-F 'Message=This is document message sent from API Curl' \
-F 'EnableSigningOrder=false' \
-F 'Signers[0][Name]=Signer Name 1' \
-F 'Signers[0][EmailAddress][email protected]' \
-F 'Files=@{Your file Path};type=application/pdf'
var apiClient = new ApiClient("https://api.boldsign.com", "{your API key}");
var documentClient = new DocumentClient(apiClient);
var documentRequest = new EmbeddedDocumentRequest
{
Title = "Sent from API SDK",
Message = "This is document message sent from API SDK",
Signers = new List<DocumentSigner>
{
new DocumentSigner(
signerName: "David",
signerType: SignerType.Signer,
signerEmail: "[email protected]",
locale: Locales.EN),
},
Files = new List<IDocumentFile>
{
new DocumentFilePath
{
ContentType = "application/pdf",
// directly provide file path
FilePath = "{Your file path}",
},
},
// customize page options
SendViewOption = PageViewOption.PreparePage,
Locale = Locales.EN,
ShowToolbar = true,
ShowNavigationButtons = true,
ShowSaveButton = true,
ShowPreviewButton = true,
ShowSendButton = true,
ShowTooltip = false,
};
var documentCreated = await documentClient.CreateEmbeddedRequestUrlAsync(documentRequest);
// url to send the document from your web application
var documentSendUrl = documentCreated.SendUrl;
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_fields = [
boldsign.FormField(
id = "Sign",
fieldType = "Signature",
pageNumber = 1,
font = "Helvetica",
bounds = boldsign.Rectangle(x = 50, y = 50, width = 200, height = 30),
isRequired = True
)
]
document_signer = boldsign.DocumentSigner(
name = "Signer Name 1",
emailAddress = "[email protected]",
signerOrder = 1,
signerType = "Signer",
authenticationCode = "1123",
privateMessage = "This is private message for signer",
formFields = form_fields,
locale = "EN"
)
embedded_document_request = boldsign.EmbeddedDocumentRequest(
title = "Sent from API Python SDK",
showToolbar = True,
showNavigationButtons = True,
showPreviewButton = True,
showSendButton = True,
showSaveButton = True,
sendViewOption = "FillingPage",
locale = "EN",
showTooltip = False,
redirectUrl = "https://boldsign.dev/sign/redirect",
message = "This is document message sent from API Python SDK",
enableSigningOrder = False,
signers = [document_signer],
files = ["YOUR_FILE_PATH"],
)
embedded_send_created = document_api.create_embedded_request_url_document(
embedded_document_request = embedded_document_request
)
<?php require_once "vendor/autoload.php";
use BoldSign\Configuration;
use BoldSign\Api\DocumentApi;
use BoldSign\Model\{FormField, Rectangle, DocumentSigner, EmbeddedDocumentRequest};
$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->setId('Sign');
$form_field->setFieldType('Signature');
$form_field->setPageNumber(1);
$form_field->setFont('Helvetica');
$form_field->setIsRequired(true);
$bounds = new Rectangle([50, 100, 100, 60]);
$form_field->setBounds($bounds);
$document_signer = new DocumentSigner();
$document_signer->setName('Signer Name 1');
$document_signer->setEmailAddress('[email protected]');
$document_signer->setSignerType('Signer');
$document_signer->setSignerOrder(1);
$document_signer->setAuthenticationCode('123');
$document_signer->setPrivateMessage('This is private message for signer');
$document_signer->setFormFields([$form_field]);
$document_signer->setLocale('EN');
$embedded_document_request = new EmbeddedDocumentRequest();
$embedded_document_request->setTitle('Sent from API PHP SDK');
$embedded_document_request->setMessage('This is document message sent from API PHP SDK');
$embedded_document_request->setEnableSigningOrder(false);
$embedded_document_request->setShowTooltip(false);
$embedded_document_request->setLocale('EN');
$embedded_document_request->setSendViewOption('FillingPage');
$embedded_document_request->setShowSaveButton(true);
$embedded_document_request->setShowSendButton(true);
$embedded_document_request->setShowPreviewButton(true);
$embedded_document_request->setShowToolbar(true);
$embedded_document_request->setSigners([$document_signer]);
$embedded_document_request->setShowNavigationButtons(true);
$embedded_document_request->setRedirectUrl('https://boldsign.dev/');
$embedded_document_request->setFiles(['YOUR_FILE_PATH']);
$embedded_send_created = $document_api->createEmbeddedRequestUrlDocument($embedded_document_request);
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.setId("Sign");
signatureField.setFieldType(FormField.FieldTypeEnum.SIGNATURE);
signatureField.setPageNumber(1);
signatureField.setFont(FormField.FontEnum.HELVETICA);
signatureField.setIsRequired(true);
Rectangle bounds = new Rectangle().x(100f).y(100f).width(100f).height(50f);
signatureField.setBounds(bounds);
DocumentSigner signer = new DocumentSigner();
signer.setName("Signer Name 1");
signer.setEmailAddress("[email protected]");
signer.setSignerOrder(1);
signer.setSignerType(DocumentSigner.SignerTypeEnum.SIGNER);
signer.setFormFields(Arrays.asList(signatureField));
signer.setAuthenticationCode("11234");
signer.setLocale(DocumentSigner.LocaleEnum.EN);
signer.setPrivateMessage("This is private message for signer");
EmbeddedDocumentRequest embeddedDocumentRequest = new EmbeddedDocumentRequest();
File file = new File("YOUR_FILE_PATH");
embeddedDocumentRequest.setFiles(Arrays.asList(file));
embeddedDocumentRequest.setShowTooltip(false);
embeddedDocumentRequest.setMessage("This is document message sent from API java SDK");
embeddedDocumentRequest.setSigners(Arrays.asList(signer));
embeddedDocumentRequest.setLocale(EmbeddedDocumentRequest.LocaleEnum.EN);
embeddedDocumentRequest.setSendViewOption(EmbeddedDocumentRequest.SendViewOptionEnum.FILLING_PAGE);
embeddedDocumentRequest.setShowSaveButton(true);
embeddedDocumentRequest.setShowSendButton(true);
embeddedDocumentRequest.setShowPreviewButton(true);
embeddedDocumentRequest.setShowToolbar(true);
embeddedDocumentRequest.setShowNavigationButtons(true);
URI redirectUrl = URI.create("https://boldsign.dev/sign/redirect");
embeddedDocumentRequest.setRedirectUrl(redirectUrl);
embeddedDocumentRequest.setEnableSigningOrder(false);
embeddedDocumentRequest.setTitle("Sent from API java SDK");
EmbeddedSendCreated embeddedSendCreated = documentApi.createEmbeddedRequestUrlDocument(embeddedDocumentRequest);
import { DocumentApi, DocumentSigner, EmbeddedDocumentRequest, FormField, Rectangle } 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.id = "Sign";
formField.fieldType = FormField.FieldTypeEnum.Signature;
formField.font = FormField.FontEnum.Helvetica;
formField.pageNumber = 1;
formField.isRequired = true;
formField.bounds = bounds;
const documentSigner = new DocumentSigner();
documentSigner.name = "Signer Name 1";
documentSigner.emailAddress = "[email protected]";
documentSigner.signerOrder = 1;
documentSigner.signerType = DocumentSigner.SignerTypeEnum.Signer;
documentSigner.authenticationCode = "1234";
documentSigner.locale = DocumentSigner.LocaleEnum.En;
documentSigner.privateMessage = "This is private message for signer";
documentSigner.formFields = [formField];
const files = fs.createReadStream("YOUR_FILE_PATH");
const embeddedDocumentRequest = new EmbeddedDocumentRequest();
embeddedDocumentRequest.title = "Sent from API Node SDK";
embeddedDocumentRequest.showToolbar = true;
embeddedDocumentRequest.showTooltip = false;
embeddedDocumentRequest.showSaveButton = true;
embeddedDocumentRequest.showSendButton = true;
embeddedDocumentRequest.showPreviewButton = true;
embeddedDocumentRequest.locale = EmbeddedDocumentRequest.LocaleEnum.En;
embeddedDocumentRequest.message = "This is document message sent from API node SDK";
embeddedDocumentRequest.sendViewOption = EmbeddedDocumentRequest.SendViewOptionEnum.FillingPage;
embeddedDocumentRequest.showNavigationButtons = true;
embeddedDocumentRequest.redirectUrl = "https://boldsign.dev/sign/redirect";
embeddedDocumentRequest.enableSigningOrder = false;
embeddedDocumentRequest.files = [files];
embeddedDocumentRequest.signers = [documentSigner];
const embeddedSendCreated = documentApi.createEmbeddedRequestUrlDocument(embeddedDocumentRequest);
In the above example, replace placeholders (Title, Message, etc,.) with actual input values gathered from your application's UI. If your application supports multiple signers, tailor the UI accordingly. Update values within the Signers array to match customized signers. Customize button options (ShowSaveButton, ShowSendButton, etc,.) based on requirements by setting them to true or false. To direct users to a form field configuration page, set SendViewOption to PreparePage. For a document upload page, set SendViewOption to FillingPage.
Executing the provided code will generate an embed link, and the document will be stored in draft status within your BoldSign account.
2. Utilize the Generated Link in an iFrame
Once the embed link is generated, integrate it into an iFrame within your application. This iFrame enables your application users to:
- Add extra signers
- Upload additional documents
- Configure form fields
- Send the document to the signer for signing
After sending the document, it will be delivered to the signer via email. This approach streamlines document creation for users, enhancing their experience and promoting efficient document management within your application.