Search code examples
docusignapi

Docusign - Auto-Place tabs not show up on base64 document


I am trying to auto-place multiple signHere tabs in one of my base64 documents where the length of the document is dynamic, based on a keyword Signature, but none of them are being attached. Here's my code snippet:

val base64String = <some_base64_string>

EnvelopeDefinition().apply {
    emailSubject = "..."
    emailBlurb = "..."
    documents = listOf(
        Document().apply {
            documentId = "1"
            name = "demo.pdf"
            documentBase64 = base64String
        }
    )
    recipients = listOf(
        Signer().apply {
            email = <email>
            name = <name>
            recipientId = "1"
            roleName = "Client"
            clientUserId = id
            val tabs = Tabs()
            tabs.signHereTabs = listOf(
                SignHere().apply {
                    anchorString = "Signature"
                    name = "signature-$id"
                    tabLabel = "sign-here-$id"
                }
            )
            this.tabs = tabs
        }
    )
}

Solution

  • You are using a template (roleName) but you also provide your own document and your own tabs.

    The purpose of a template is to have a repetitive process where something is repeated. Either the documents or the tabs or the recipients.

    Not sure what you're trying to do here, but either:

    1. Don't use a template.
    2. Have the tabs defined on the template.
    3. Have the document in the template.

    The way you have it won't work cause the tabs won't be applied to the new document.

    For your tab code , try something like this:

    sign_here1 = {
        anchorString = "Signature", anchorYOffset = "10", anchorUnits = "pixels",
        anchorXOffset = "20"}