-->

Docusign Transform Pdf Fields For multiple recipie

2019-02-18 19:20发布

问题:

I saw the DocuSign API can automatically transform and assign pdf fields to a single default recipient (Docusign Transform Pdf Fields For single recipient?).

Is it possible to do the assignment for multiple recipients?

I am hoping to leverage the auto transform feature but at the same time assign different pdf fields to different recipients during envelope creation.

Thanks.

回答1:

The following sample creates an envelope using the REST API using base64 encoded pdfBytes that represents a PDF document that contains a number of adobe form fields: option field, check boxes, signature fields. We use name of the adobe field to map this field to a DocuSign tag created for each recipient.

Note that the key here is to name each PDF form field with a format that it is easily assignable to recipient by using a wildcard.

Please refer to the Document Parameters (under note) for the rules used to match adobe fields to DS fields. We will be transforming all adobe fields and assigning them to two recipients, to do this we will be creating each signer and tags, the way we will be binding each DS tag created by using wildcards on the tabLabel. We will be also setting values for some of the data fields and we will be selecting radio button grouped in a parent and selecting check boxes that we have created as a result of transforming these fields.

HTTP Headers:

Accept: application/json

X-DocuSign-Authentication: {"Username": "your_sender@mail", "Password":"your_password",      "IntegratorKey":"your_integration_key"}

Content-Type: multipart/form-data; boundary=e6e95273-cafb-4dbf-86b8-a1c0ed85b5c5

Resource: https://{env}.docusign.net/restapi/{version}/accounts/{accountId}/envelopes
Method: POST

Payload:

  --e6e95273-cafb-4dbf-86b8-a1c0ed85b5c5
  Content-Type: application/json
  Content-Disposition: form-data

  {
     "status":"sent",
     "emailSubject":"Test transforming pdf forms and assigning them to each user",
     "compositeTemplates":[
        {
           "inlineTemplates":[
              {
                 "sequence":1,
                 "recipients":{
                    "signers":[
                       {
                          "email":"[replace this with a valid email]",
                          "name":"Signer One",
                          "recipientId":"1",
                          "routingOrder":"1",
                          "tabs":{
                             "textTabs":[
                                {
                                   "tabLabel":"PrimarySigner\\*",
                                   "value":"Signer One"
                                }
                             ],
                             "checkboxTabs":[
                                {
                                   "tabLabel":"PrimarySigner\\*",
                                   "selected":true
                                }
                             ],
                             "signHereTabs":[
                                {
                                   "tabLabel":"PrimarySigner\\*"
                                }
                             ],
                             "dateSignedTabs":[
                                {
                                   "tabLabel":"PrimarySigner\\*"
                                }
                             ],
                             "radioGroupTabs":[
                                {
                                   "groupName":"PrimarySigner\\*",
                                   "radios":[
                                      {
                                         "value":"M",
                                         "selected":true
                                      }
                                   ]
                                }
                             ]
                          }
                       },
                       {
                          "email":"[replace this with a valid email]",
                          "name":"Signer Two",
                          "recipientId":"2",
                          "routingOrder":"2",
                          "tabs":{
                             "textTabs":[
                                {
                                   "tabLabel":"SecondarySigner\\*",
                                   "value":"Secondary One"
                                }
                             ],
                             "checkboxTabs":[
                                {
                                   "tabLabel":"SecondarySigner\\*",
                                   "selected":true
                                }
                             ],
                             "signHereTabs":[
                                {
                                   "tabLabel":"SecondarySigner\\*"
                                }
                             ],
                             "dateSignedTabs":[
                                {
                                   "tabLabel":"SecondarySigner\\*"
                                }
                             ],
                             "radioGroupTabs":[
                                {
                                   "groupName":"SecondarySigner\\*",
                                   "radios":[
                                      {
                                         "value":"F",
                                         "selected":true
                                      }
                                   ]
                                }
                             ]
                          }
                       }
                    ]
                 }
              }
           ],
           "document":{
              "documentId":1,
              "name":"test.pdf",
              "transformPdfFields":true
           }
        }
     ]
  }

  --e6e95273-cafb-4dbf-86b8-a1c0ed85b5c5
  Content-Type: application/pdf
  Content-Disposition: file; filename="test1.pdf"; documentId=1
  Content-Transfer-Encoding: base64

  [replace this with a base64 encoded]

  --e6e95273-cafb-4dbf-86b8-a1c0ed85b5c5--


标签: docusignapi