
Together We Grow Join our affiliate program to earn consistent income for each sale you refer to us.
Together We Grow Join our affiliate program to earn consistent income for each sale you refer to us.
Sign up for a free sandbox.
dotnet new webapp --framework "netcoreapp3.1" -o ASPCoreEsignApp |
dotnet add package BoldSign.Api |
Acquire the necessary BoldSign app credentials.
var apiClient = new ApiClient("https://api.boldsign.com/"," ***API Key***");
services.AddSingleton(apiClient);
services.AddSingleton(new DocumentClient(apiClient));
services.AddSingleton(new TemplateClient(apiClient));
private readonly IDocumentClient documentClient;
private readonly ITemplateClient templateClient;
public IndexModel(IDocumentClient documentClient, ITemplateClient templateClient, ILogger logger)
{
this.documentClient = documentClient;
this.templateClient = templateClient;
}
public void SignDocument()
{
// Read the document from local path as stream.
using var fileStream = System.IO.File.OpenRead("doc-2.pdf");
var documentStream = new DocumentFileStream
{
ContentType = "application/pdf",
FileData = fileStream,
FileName = "doc-2.pdf",
};
// Creating collection with the loaded document.
var filesToUpload = new List<IDocumentFile>
{
documentStream,
};
// Creating signature field.
var signatureField = new FormField(
id: "Sign",
type: FieldType.Signature,
pageNumber: 1,
isRequired: true,
bounds: new Rectangle(x: 50, y: 50, width: 200, height: 30));
// Adding the field to the collection.
List<FormField> formFields = new List<FormField>();
formFields.Add(signatureField);
// Creating signer field.
var signer = new DocumentSigner(
name: "Signer Name 1",
emailAddress: "signer@cubeflakes.com",
signerOrder: 1,
authenticationCode: "851321",
signerType: SignerType.Signer,
privateMessage: "This is private message for signer",
// Assign the created form fields to the signer.
formFields: formFields);
// Adding the signer to the collection.
var documentSigners = new List<DocumentSigner>
{
signer
};
// Create send for sign request object.
var sendForSign = new SendForSign
{
Title = "Sent from API SDK",
Message = "This is document message sent from API SDK",
EnableSigningOrder = false,
// Assign the signers collection.
Signers = documentSigners,
// Assign the loaded files collection.
Files = filesToUpload
};
// Send the document for signing.
var createdDocumentResult = this.documentClient.SendDocument(sendForSign);
}
Navigate to the My Templates section in the BoldSign app. You can see the created templates in the list.
Click the more options button at the right end of the template you want to send and choose the Copy template ID option to copy the template’s ID.
Use the copied template ID to send your document for signing. You can directly use the template with a predefined set of recipients or add the recipients to the document before sending the signature request. Refer to the following code example.
public void SendDocumentUsingTemplate()
{
var templateDetails = new SendForSignFromTemplate(
templateId: "**templateId**",
title: "Document from Template",
message: "This document description");
var createdDocumentResult = this.templateClient.SendUsingTemplate(templateDetails);
}
Jayaprakash Kamaraj is a Product Manager at Syncfusion. He is passionate about front-end technologies and has been active in web development since 2014.
Jayaprakash Kamaraj is a Product Manager at Syncfusion. He is passionate about front-end technologies and has been active in web development since 2014.
Latest Articles
Automate Your eSignature Workflows with BoldSign Integrations on Zapier
Integrate Electronic Signature Capabilities into Your SaaS Applications
Syncfusion’s BoldSign is now SOC 2® Type 2 compliant