Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
307 views
in Technique[技术] by (71.8m points)

java - Several editable PDF

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 ?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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": "[email protected]",
                    "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": "[email protected]",
                    "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--

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...