BoldSign Mobile Icon

Getting started

Thu, 31 Mar, 2021

Uploading documents

The best way to get started is to read the “Prepare your application” section of the documentation, for the application that you want to start using first (link).

Prepare to send document for signing by creating new instance of the DocumentClient as shown below.

var documentClient = new DocumentClient(apiClient);

To send the document for signature the list of documents which needs to be signed should be added in IDocumentFile collection.

Load the document as stream and create an instance of DocumentFileStream with it and add it to the IDocumentFile collection as shown below:

// Read document from local path as stream.
using var fileStream = File.OpenRead("doc-2.pdf");
var documentStream = new DocumentFileStream
    ContentType = "application/pdf",
    FileData = fileStream,
    FileName = "doc-2.pdf",

// Creating collection with loaded document.
var filesToUpload = new List<IDocumentFile>

You can also upload multiple documents and add it in the filesToUpload collection mentioned in the above code. The document can also be loaded as byte array or directly from a file path.

The upload operation accepts file formats like .pdf, .png, .jpg, and .docx.

Adding form fields

Now that the documents are loaded, we need to create the form fields to be signed or filled by the signer. Below code demonstrates the creation of signature field and it is added to a form field collection.

// 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> formFeilds = new List<FormField>();

You can also add multiple form fields in the form fields collection and this collection can be assigned to a particular signer.

Adding signers

The document and its form fields requires signing. So specify the signer to sign the form fields.

Create a new instance of DocumentSigner with all required signer information and assign the collection of form fields which is created in the last step.

// Creating signer field.
var signer = new DocumentSigner(
        name: "Signer Name 1",
        emailAddress: "",
        signerOrder: 1,
        authenticationCode: "123",
        signerType: SignerType.Signer,
        privateMessage: "This is private message for signer",
        // Assign the created form fields to the signer.
        formFields: formFeilds);

// Adding the signer to the collection.
var documentSigners = new List<DocumentSigner>

Send document to sign

The last step is to send the document for signing with defined document, form fields and 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 = documentClient.SendDocument(sendForSign);
curl -X POST '' \
-H 'Authorization: Bearer <authtoken>' \
-F 'Title=Sent from API Curl' \
-F 'Message=This is document message sent from API Curl' \
-F 'EnableSigningOrder=false' \
-F 'Signers[0][Name]=Signer Name 1' \
-F 'Signers[0][EmailAddress]' \
-F 'Signers[0][SignerOrder]=1' \
-F 'Signers[0][authenticationCode]=1123' \
-F 'Signers[0][PrivateMessage]=This is private message for signer' \
-F 'Signers[0][FormFields][0][FieldType]=Signature' \
-F 'Signers[0][FormFields][0][Id]=Sign' \
-F 'Signers[0][FormFields][0][PageNumber]=1' \
-F 'Signers[0][FormFields][0][IsRequired]=True' \
-F 'Signers[0][FormFields][0][Bounds][X]=50' \
-F 'Signers[0][FormFields][0][Bounds][Y]=50' \
-F 'Signers[0][FormFields][0][Bounds][Width]=200' \
-F 'Signers[0][FormFields][0][Bounds][Height]=30' \
-F 'Files=@NDA.pdf;type=application/pdf'

The return type createdDocumentResult will contain the document ID of the document created which can be used in later stages to get the particular document related operations.

Copied to clipboard