Several editable PDF

2019-09-24 04:52发布

I'm working on creating a DocuSign envelope with the Java API. Everything is perfect, I can add documents, recipients and tabs.

Now, I'd like to take advantage of the editable PDF. I saw than DocuSign is capable of converting editable PDF tabs into DocuSign tabs, like describing here.

My situation is a little different as I can have several documents, some which are fillable, others that are not.

Imagine that I have three documents. DocA and DocB are fillable, DocC isn't.

I see several solutions :

  • DocA et DocB are each associated with a CompositeTemplate, DocC isn't in a Template ;
  • The three documents are each in a CompositeTemplate.

What do you think is the best solution ? And where am I suppose to define my recipients ? You need to know that I will add documents and tabs into the envelope, once it will be sent.

Any help is welcome ! Thanks

EDIT : Why a downvote without explanation ?

1条回答
做自己的国王
2楼-- · 2019-09-24 05:02

You need to have an array of compositetemplates, DocA and DocB will come from ServerTemplates and DocC will add as an inlineTemplates. I have put a sample CompositeTemplate calls, where templatedId - E5577130-E7C4-4601-B618-95DD79644971 is having adding document to the envelope from first composite template (Your DocA/DocB scenario) and "documentId" : "2" coming from inlineTemplate. And recipients are declared in each composite templates separately.

POST /restapi/v2/accounts/{{acctID}}/envelopes HTTP/1.1
Host: demo.docusign.net
X-DocuSign-Authentication: <DocuSignCredentials><Username>{{user}}
</Username><Password>{{pwd}}</Password><IntegratorKey>{{IntegratorKey}}
</IntegratorKey></DocuSignCredentials>
Content-Type: multipart/form-data; boundary=BOUNDARY

--BOUNDARY
Content-Type: application/json
Content-Disposition: form-data

{
"emailSubject": "REST example - two docs, one from template and one direct",
"enableWetSign": false,
"enforceSignerVisibility": false,
"status": "created",
"compositeTemplates": [
 {
    "compositeTemplateId": "1",
    "inlineTemplates": [
      {
            "recipients": {
                "signers": [
                 {
                    "email": "abc.from.docusign@gmail.com",
                    "name": "Daffy Duck",
                    "recipientId": "1",
                    "roleName": "Primary_Signer",
                    "tabs":{
                        "textTabs":[
                            {
                                 "documentId":"1",
                                 "pageNumber":"1",
                                 "xPosition":"525",
                                 "yPosition":"750",
                                 "recipientId":"1",
                                 "locked":"true",
                                 "tabLabel":"Primary_TrxID",
                                 "value": "e93k33"
                            }
                        ]
                    }
                  }
                ]
            },
            "sequence": "2"
        }
      ],
       "serverTemplates": 
      [
        {
            "sequence": "1",
            "templateId": "E5577130-E7C4-4601-B618-95DD79644971"
        }
      ]
  },
  {
    "compositeTemplateId": "2",
      "inlineTemplates": [
         {
            "recipients": {
            "signers": [
                {
                    "email": "abc.from.docusign@gmail.com",
                    "name": "Daffy Duck",
                    "recipientId": "1",
                    "roleName": "Primary_Signer",
                    "tabs":{
                        "textTabs":[
                            {
                                 "documentId":"2",
                                 "pageNumber":"1",
                                 "xPosition":"525",
                                 "yPosition":"750",
                                 "recipientId":"1",
                                 "locked":"true",
                                 "tabLabel":"Primary_TrxID",
                                 "value": "e93k33"
                            }
                        ]
                    }
                  }
                ]
            },
            "sequence": "1"
        }
     ],
    "document" : 
    {
        "documentId" : "2",
        "name": "Option2"
    }
   }
  ]
}

--BOUNDARY
Content-Disposition: file; documentid=2; name="Option2"; 
filename="Option2.pdf"; compositeTemplateId=2
Content-Type: application/pdf
Content-Transfer-Encoding: base64

 <DocBytesBase64>

--BOUNDARY--
查看更多
登录 后发表回答