首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用Docusign预填充但不签名文档

使用Docusign预填充但不签名文档
EN

Stack Overflow用户
提问于 2021-11-22 18:54:10
回答 2查看 52关注 0票数 0

我们有一个流程,在这个流程中,我们希望使用应用程序中预先填充的数据来生成已完成的合同。在某些情况下,文档需要由人工签名,但在其他情况下,它们实际上不需要人工签名(例如,我们不需要对生成的合同进行人工审查)。我可以使用Docusign来实现这两种文档吗?我们希望有一个人为我们所有的模板设置所有的标签,不管他们是否需要人类签名。

EN

回答 2

Stack Overflow用户

发布于 2021-11-22 19:04:41

DocuSign完成的信封必须由至少一个收件人“操作”。这意味着您的第二个场景(没有人类签名)将需要一些其他类型的人类交互。例如,您有一个必须查看信封/文档的收件人。他们不需要签名,但他们必须与信封互动。这是目前无法避免的要求。

是的,在这两种情况下都可以使用预填充域,您可以像I explain this this blog post一样以编程方式完成这项工作。下面是在创建信封后如何在C#中执行此操作:

代码语言:javascript
复制
// You need to obtain an access token using your chosen authentication flow 
var apiClient = new ApiClient(basePath);
apiClient.Configuration.DefaultHeader.Add("Authorization", "Bearer " + accessToken);
EnvelopesApi envelopesApi = new EnvelopesApi(apiClient);
PrefillTabs prefillTabs = new PrefillTabs();
prefillTabs.TextTabs = new List<Text>();
prefillTabs.TextTabs.Add(new Text { PageNumber = "1", DocumentId = "1", Value = "MyValue" });
Tabs tabs = new Tabs();
tabs.PrefillTabs = prefillTabs;
envelopesApi.CreateDocumentTabs(accountId, envelopeId, "1", tabs);
票数 0
EN

Stack Overflow用户

发布于 2021-11-22 21:21:40

可以,您可以创建一个不会被人看到的信封。

通过将抄送收件人添加到不存在的电子邮件地址(例如fake@example.com)来实现此目的。

您需要使用预填充制表符。

下面是一个JSON示例,后面是示例C#

代码语言:javascript
复制
  {
    "emailSubject": "Envelope for the record",
    "status": "sent",
    "documents": [
      {
        "filename": "anchorfields.pdf",
        "name": "Example document",
        "fileExtension": "pdf",
        "documentId": "1",
        "tabs": {
          "prefillTabs": {
            "textTabs": [
              {
                "anchorString": "/field1/ ",
                "bold": "true",
                "font": "Garamond",
                "fontColor": "BrightBlue",
                "fontSize": "Size14",
                "value": "This field and the following are all \"prefill\" fields: "
              },
              {
                "anchorString": "/field1/ ",
                "anchorXOffset": "0",
                "anchorYOffset": "30",
                "bold": "true",
                "font": "Garamond",
                "fontColor": "Black",
                "fontSize": "Size12",
                "value": "Checkbox:"
              },
              {
                "anchorString": "/field1/ ",
                "anchorXOffset": "90",
                "anchorYOffset": "30",
                "bold": "true",
                "font": "Garamond",
                "fontColor": "Black",
                "fontSize": "Size12",
                "value": "Radio button:"
              },
              {
                "anchorString": "/field1/ ",
                "anchorXOffset": "0",
                "anchorYOffset": "60",
                "bold": "true",
                "font": "Garamond",
                "fontColor": "Black",
                "fontSize": "Size12",
                "value": "Sender name:"
              },
              {
                "anchorString": "/field1/ ",
                "anchorXOffset": "190",
                "anchorYOffset": "60",
                "bold": "true",
                "font": "Garamond",
                "fontColor": "Black",
                "fontSize": "Size12",
                "value": "Sender company:"
              }
            ],
            "checkboxTabs": [
              {
                "anchorString": "/field1/ ",
                "anchorXOffset": "70",
                "anchorYOffset": "30",
                "fontSize": "Size14",
                "selected": "true"
              }
            ],
            "radioGroupTabs": [
              {
                "radios": [
                  {
                    "anchorString": "/field1/",
                    "anchorXOffset": "185",
                    "anchorYOffset": "30",
                    "selected": "true",
                    "fontSize": "Size14"
                  }
                ]
              }
            ],
            "senderNameTabs": [
              {
                "anchorString": "/field1/ ",
                "anchorXOffset": "90",
                "anchorYOffset": "58",
                "font": "Garamond",
                "fontColor": "DarkGreen",
                "fontSize": "Size12"
              }
            ],
            "senderCompanyTabs": [
              {
                "anchorString": "/field1/ ",
                "anchorXOffset": "310",
                "anchorYOffset": "58",
                "font": "Garamond",
                "fontColor": "DarkGreen",
                "fontSize": "Size12"
              }
            ]
          }
        }
      }
    ],
    "recipients": {
      "carbonCopies": [
        {
          "email": "fakeEmail@example.com",
          "name": "Envelope created for the records",
          "recipientId": "1"
        }
      ]
    }
  }

C#

代码语言:javascript
复制
// DocuSign Builder example. Generated: Mon, 22 Nov 2021 21:17:29 GMT
// DocuSign (c) 2021. MIT License -- https://opensource.org/licenses/MIT
// @see https://developers.docusign.com -- DocuSign Developer Center

using System.Collections.Generic;
using System.IO;
using System;
using DocuSign.eSign.Api;
using DocuSign.eSign.Client;
using DocuSign.eSign.Model;

namespace CSharp_example
{
    class Program
    {
        
        // obtain the accessToken from an oauth flow
        // obtain the accountId and basePath from /oauth/userinfo
        private const string accessToken = ;
        private const string accountId = 
        private const string basePath = "https://demo.docusign.net/restapi";

        // Create the envelope request and send it to DocuSign
        // Returns the resulting envelopeId or ""
        static string SendDocuSignEnvelope()
        {
            CarbonCopy carbonCopy1 = new CarbonCopy
            {
                Email = "fakeEmail@example.com",  
                Name = "Envelope created for the records",  
                RecipientId = "1" 
            };
            List<CarbonCopy> carbonCopies1 = new List<CarbonCopy> {carbonCopy1};
            Recipients recipients1 = new Recipients
            {
                CarbonCopies = carbonCopies1 
            };
            Text textTab1 = new Text
            {
                AnchorString = "/field1/ ",  
                Bold = "true",  
                Font = "Garamond",  
                FontColor = "BrightBlue",  
                FontSize = "Size14",  
                Value = "This field and the following are all ""prefill"" fields: " 
            };
            Text textTab2 = new Text
            {
                AnchorString = "/field1/ ",  
                AnchorXOffset = "0",  
                AnchorYOffset = "30",  
                Bold = "true",  
                Font = "Garamond",  
                FontColor = "Black",  
                FontSize = "Size12",  
                Value = "Checkbox:" 
            };
            Text textTab3 = new Text
            {
                AnchorString = "/field1/ ",  
                AnchorXOffset = "90",  
                AnchorYOffset = "30",  
                Bold = "true",  
                Font = "Garamond",  
                FontColor = "Black",  
                FontSize = "Size12",  
                Value = "Radio button:" 
            };
            Text textTab4 = new Text
            {
                AnchorString = "/field1/ ",  
                AnchorXOffset = "0",  
                AnchorYOffset = "60",  
                Bold = "true",  
                Font = "Garamond",  
                FontColor = "Black",  
                FontSize = "Size12",  
                Value = "Sender name:" 
            };
            Text textTab5 = new Text
            {
                AnchorString = "/field1/ ",  
                AnchorXOffset = "190",  
                AnchorYOffset = "60",  
                Bold = "true",  
                Font = "Garamond",  
                FontColor = "Black",  
                FontSize = "Size12",  
                Value = "Sender company:" 
            };
            List<Text> textTabs1 = new List<Text> {textTab1, textTab2, textTab3, textTab4, textTab5};
            Checkbox checkboxTab1 = new Checkbox
            {
                AnchorString = "/field1/ ",  
                AnchorXOffset = "70",  
                AnchorYOffset = "30",  
                FontSize = "Size14",  
                Selected = "true" 
            };
            List<Checkbox> checkboxTabs1 = new List<Checkbox> {checkboxTab1};
            Radio radio1 = new Radio
            {
                AnchorString = "/field1/",  
                AnchorXOffset = "185",  
                AnchorYOffset = "30",  
                FontSize = "Size14",  
                Selected = "true" 
            };
            List<Radio> radios1 = new List<Radio> {radio1};
            RadioGroup radioGroupTab1 = new RadioGroup
            {
                Radios = radios1 
            };
            List<RadioGroup> radioGroupTabs1 = new List<RadioGroup> {radioGroupTab1};
            SenderName senderNameTab1 = new SenderName
            {
                AnchorString = "/field1/ ",  
                AnchorXOffset = "90",  
                AnchorYOffset = "58",  
                Font = "Garamond",  
                FontColor = "DarkGreen",  
                FontSize = "Size12" 
            };
            List<SenderName> senderNameTabs1 = new List<SenderName> {senderNameTab1};
            SenderCompany senderCompanyTab1 = new SenderCompany
            {
                AnchorString = "/field1/ ",  
                AnchorXOffset = "310",  
                AnchorYOffset = "58",  
                Font = "Garamond",  
                FontColor = "DarkGreen",  
                FontSize = "Size12" 
            };
            List<SenderCompany> senderCompanyTabs1 = new List<SenderCompany> {senderCompanyTab1};
            PrefillTabs prefillTabs1 = new PrefillTabs
            {
                CheckboxTabs = checkboxTabs1,  
                RadioGroupTabs = radioGroupTabs1,  
                SenderCompanyTabs = senderCompanyTabs1,  
                SenderNameTabs = senderNameTabs1,  
                TextTabs = textTabs1 
            };
            Tabs tabs1 = new Tabs
            {
                PrefillTabs = prefillTabs1 
            };
            Document document1 = new Document
            {
                DocumentId = "1",  
                FileExtension = "pdf",  
                DocumentBase64 = ReadContent("anchorfields.pdf"),  // filename is anchorfields.pdf
                Name = "Example document",  
                Tabs = tabs1 
            };
            List<Document> documents1 = new List<Document> {document1};
            EnvelopeDefinition envelopeDefinition = new EnvelopeDefinition
            {
                Documents = documents1,  
                EmailSubject = "Envelope for the record",  
                Recipients = recipients1,  
                Status = "sent" 
            };

            ApiClient apiClient = new ApiClient(basePath);
            apiClient.Configuration.AddDefaultHeader("Authorization", "Bearer " + accessToken);
            EnvelopesApi envelopesApi = new EnvelopesApi(apiClient);
            try
            {
                EnvelopeSummary results = envelopesApi.CreateEnvelope(accountId, envelopeDefinition);
                Console.WriteLine($"Envelope status: {results.Status}. Envelope ID: {results.EnvelopeId}");
                return results.EnvelopeId;
            }
            catch (ApiException e)
            {
                Console.WriteLine("Exception while creating envelope!");
                Console.WriteLine($"Code: {e.ErrorCode}\nContent: {e.ErrorContent}");
                //Console.WriteLine(e.Message);
                return "";
            }
        }


        /// <summary>
        /// This method read bytes content from files in the project's Resources directory
        /// </summary>
        /// <param name="fileName">resource path</param>
        /// <returns>return Base64 encoded content as string</returns>
        internal static string ReadContent(string fileName)
        {
            byte[] buff = null;
            string path = Path.Combine(Directory.GetCurrentDirectory(), @"..\..\..\Resources", fileName);
            using (FileStream stream = new FileStream(path, FileMode.Open, FileAccess.Read))
            {
                using (BinaryReader br = new BinaryReader(stream))
                {
                    long numBytes = new FileInfo(path).Length;
                    buff = br.ReadBytes((int)numBytes);
                }
            }
            return Convert.ToBase64String(buff);
        }

        // The mainline
        static void Main(string[] args)
        {
            Console.WriteLine("Starting...");
            string envelopeId = SendDocuSignEnvelope();
            Console.WriteLine("Done.");
        }
    }
}
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/70070991

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档