我一直在使用Docusign的API处理我公司的项目。目的是允许对文档进行数字签名,从而使业务流程付诸实践。最近,我添加了第三个文档,当选中一个复选框时,第三个文档被添加到要签名的信封中(这是acc = True
进入的位置。但是,问题是,专门为此在第三个文档中,在定位字符串所在的其他文档上的任何位置,都将放置字段,从而导致制表符不仅会转到非预期字段,还会指向非预期文档上的意外字段。
在所有选项卡中,我都设置了值anchor_match_whole_word = 'true'
,在第三个文档的选项卡中,我都设置了值document_id = '3'
。下面是我的代码:
signer1 = docusign.Signer(email = myClient.email, name = myClient.ainame, recipient_id = '1')
signer2 = docusign.Signer(email = "myEmail@gmail.com", name = "Sam Sampleton", recipient_id = '2')
sign_here1 = docusign.SignHere(document_id = '1', recipient_id = '1', anchor_horizontal_alignment = 'left', anchor_ignore_if_not_present = 'false', anchor_match_whole_word = 'true', anchor_string = "Signature of individual authorized to act on behalf of customer", anchor_x_offset = ".2", anchor_y_offset = "1.25", anchor_units = "cms", tab_label = "Signature of individual authorized to act on behalf of customer",)
sign_here2 = docusign.SignHere(document_id = '2', recipient_id = '1', anchor_horizontal_alignment = 'right', anchor_ignore_if_not_present = 'false', anchor_match_whole_word = 'true', anchor_string = "Customer Signature", anchor_x_offset = ".5", anchor_y_offset = ".5", anchor_units = "cms", tab_label = "Customer Signature",)
sign_here3 = docusign.SignHere(document_id = '2', recipient_id = '2', anchor_horizontal_alignment = 'right', anchor_ignore_if_not_present = 'false', anchor_match_whole_word = 'true', anchor_string = "Employee Signature", anchor_x_offset = ".5", anchor_y_offset = ".5", anchor_units = "cms", tab_label = "Employee Signature",)
if acc == True:
sign_here4 = docusign.SignHere(document_id = '3', recipient_id = '1', anchor_horizontal_alignment = 'left', anchor_ignore_if_not_present = 'false', anchor_match_whole_word = 'true', anchor_string = 'Authorized Customer Signature', anchor_x_offset = '.05', anchor_y_offset = '-.5', anchor_units = 'cms', tab_label = "Authorized Customer Signature")
sign_here5 = docusign.SignHere(document_id = '3', recipient_id = '2', anchor_horizontal_alignment = 'left', anchor_ignore_if_not_present = 'false', anchor_match_whole_word = 'true', anchor_string = 'Authorized Mitech Partners Signature', anchor_x_offset = '1', anchor_y_offset = '-1', anchor_units = 'cms', tab_label = "Authorized Mitech Partners Signatures")
cust_name = docusign.Text(document_id = '3', recipient_id = '1', anchor_horizontal_alignment = 'left', anchor_ignore_if_not_present = 'false', anchor_match_whole_word = 'true', anchor_string = 'Customer Name (Legal Name)', anchor_x_offset = '-.25', anchor_y_offset = '.35', anchor_units = 'cms', tab_label = 'Customer Name (Legal Name)')
business_address = docusign.Text(document_id = '3', recipient_id = '1', anchor_horizontal_alignment = 'left', anchor_ignore_if_not_present = 'false', anchor_match_whole_word = 'true', anchor_string = 'Business Street Address:', anchor_x_offset = '-.25', anchor_y_offset = '.35', anchor_units = 'cms', tab_label = 'Business Street Address')
suite = docusign.Text(document_id = '3', recipient_id = '1', anchor_horizontal_alignment = 'left', anchor_ignore_if_not_present = 'false', anchor_match_whole_word = 'true', anchor_string = 'Suite#', anchor_x_offset = '-.25', anchor_y_offset = '.35', anchor_units = 'cms', tab_label = 'Suite#')
city = docusign.Text(document_id = '3', recipient_id = '1', anchor_horizontal_alignment = 'left', anchor_ignore_if_not_present = 'false', anchor_match_whole_word = 'true', anchor_string = 'City:', anchor_x_offset = '-.25', anchor_y_offset = '.35', anchor_units = 'cms', tab_label = 'City')
state = docusign.Text(document_id = '3', recipient_id = '1', anchor_horizontal_alignment = 'left', anchor_ignore_if_not_present = 'false', anchor_match_whole_word = 'true', anchor_string = 'State:', anchor_x_offset = '-.25', anchor_y_offset = '.35', anchor_units = 'cms', tab_label = 'State')
zip_code = docusign.Text(document_id = '3', recipient_id = '1', anchor_horizontal_alignment = 'left', anchor_ignore_if_not_present = 'false', anchor_match_whole_word = 'true', anchor_string = 'Zip:', anchor_x_offset = '-.25', anchor_y_offset = '.35', anchor_units = 'cms', tab_label = 'Zip Code')
contact_name = docusign.Text(document_id = '3', recipient_id = '1', anchor_horizontal_alignment = 'left', anchor_ignore_if_not_present = 'false', anchor_match_whole_word = 'true', anchor_string = 'Customer Contact Name:', anchor_x_offset = '-.25', anchor_y_offset = '.35', anchor_units = 'cms', tab_label = 'Customer Contact Name')
contact_phone = docusign.Text(document_id = '3', recipient_id = '1', anchor_horizontal_alignment = 'left', anchor_ignore_if_not_present = 'false', anchor_match_whole_word = 'true', anchor_string = 'Customer Phone:', anchor_x_offset = '-.25', anchor_y_offset = '.35', anchor_units = 'cms', tab_label = 'Customer Phone Number')
extension = docusign.Text(document_id = '3', recipient_id = '1', anchor_horizontal_alignment = 'left', anchor_ignore_if_not_present = 'false', anchor_match_whole_word = 'true', anchor_string = 'Extension:', anchor_x_offset = '-.25', anchor_y_offset = '.35', anchor_units = 'cms', tab_label = 'Extension')
fax = docusign.Text(document_id = '3', recipient_id = '1', anchor_horizontal_alignment = 'left', anchor_ignore_if_not_present = 'false', anchor_match_whole_word = 'true', anchor_string = 'Fax:', anchor_x_offset = '-.25', anchor_y_offset = '.35', anchor_units = 'cms', tab_label = 'Fax:')
alternate_phone = docusign.Text(document_id = '3', recipient_id = '1', anchor_horizontal_alignment = 'left', anchor_ignore_if_not_present = 'false', anchor_match_whole_word = 'true', anchor_string = 'Alternate Phone:', anchor_x_offset = '-.25', anchor_y_offset = '.35', anchor_units = 'cms', tab_label = 'Alternate Phone')
email_address = docusign.Text(document_id = '3', recipient_id = '1', anchor_horizontal_alignment = 'left', anchor_ignore_if_not_present = 'false', anchor_match_whole_word = 'true', anchor_string = 'Email:', anchor_x_offset = '-.25', anchor_y_offset = '.35', anchor_units = 'cms', tab_label = 'Customer Email')
cust_print = docusign.Text(document_id = '3', recipient_id = '1', anchor_horizontal_alignment = 'left', anchor_ignore_if_not_present = 'false', anchor_match_whole_word = 'true', anchor_string = 'Printed Name', anchor_x_offset = '-.2', anchor_y_offset = '-.4', anchor_units = 'cms', tab_label = 'Authorized Customer Printed Name')
cust_title = docusign.Text(document_id = '3', recipient_id = '1', anchor_horizontal_alignment = 'left', anchor_ignore_if_not_present = 'false', anchor_match_whole_word = 'true', anchor_string = 'Title', anchor_x_offset = '-.2', anchor_y_offset = '-.4', anchor_units = 'cms', tab_label = 'Authorized Customer Title')
cust_date_signed = docusign.Text(document_id = '3', recipient_id = '1', anchor_horizontal_alignment = 'left', anchor_ignore_if_not_present = 'false', anchor_match_whole_word = 'true', anchor_string = 'Date Signed', anchor_x_offset = '-.1', anchor_y_offset = '-.4', anchor_units = 'cms', tab_label = 'Customer Sign Date')
ln_name = docusign.Text(document_id = '3', recipient_id = '2', anchor_horizontal_alignment = 'left', anchor_ignore_if_not_present = 'false', anchor_match_whole_word = 'true', anchor_string = 'Printed Name', anchor_x_offset = '-.2', anchor_y_offset = '-.4', anchor_units = 'cms', tab_label = 'Employee Printed Name')
ln_title = docusign.Text(document_id = '3', recipient_id = '2', anchor_horizontal_alignment = 'left', anchor_ignore_if_not_present = 'false', anchor_match_whole_word = 'true', anchor_string = 'Title', anchor_x_offset = '-.2', anchor_y_offset = '-.4', anchor_units = 'cms', tab_label = 'Employee Title')
ln_date_signed = docusign.Text(document_id = '3', recipient_id = '2', anchor_horizontal_alignment = 'left', anchor_ignore_if_not_present = 'false', anchor_match_whole_word = 'true', anchor_string = 'Date Signed', anchor_x_offset = '-.1', anchor_y_offset = '-.4', anchor_units = 'cms', tab_label = 'My Company Date Signed')
if acc == True:
tabs1 = docusign.Tabs(sign_here_tabs = [sign_here1, sign_here2, sign_here4], text_tabs = [cust_name, business_address, suite, city, state, contact_name, contact_phone, extension, fax, alternate_phone, email_address, cust_print, cust_title], date_signed_tabs = [cust_date_signed])
tabs2 = docusign.Tabs(sign_here_tabs = [sign_here3, sign_here5], text_tabs = [ln_name, ln_title], date_signed_tabs = [ln_date_signed])
else:
tabs1 = docusign.Tabs(sign_here_tabs = [sign_here1, sign_here2])
tabs2 = docusign.Tabs(sign_here_tabs = [sign_here3])
signers = []
signer1.tabs = tabs1
signer2.tabs = tabs2
signers.append(signer1)
signers.append(signer2)
recipients = docusign.Recipients(signers = signers)
envelope_definition = docusign.EnvelopeDefinition(email_subject = "Please Sign the Following Documents", email_blurb = "Please sign the following documents to complete the process!" )
with open(pdfpath1, 'rb') as signfile1, open(pdfpath2, 'rb') as signfile2, open(pdfpath3, 'rb') as signfile3:
file_data1 = signfile1.read()
doc = docusign.Document()
base64_doc = base64.b64encode(file_data1).decode('utf-8')
doc.document_base64 = base64_doc
doc.name = "Info.pdf"
doc.document_id = '1'
file_data2 = signfile2.read()
doc2 = docusign.Document()
base64_doc2 = base64.b64encode(file_data2).decode('utf-8')
doc2.document_base64 = base64_doc2
doc2.name = "ServiceAgreement.pdf"
doc2.document_id = '2'
if acc == True:
file_data3 = signfile3.read()
doc3 = docusign.Document()
base64_doc3 = base64.b64encode(file_data3).decode('utf-8')
doc3.document_base64 = base64_doc3
doc3.name = "ACC.pdf"
doc3.document_id = '3'
envelope_definition.documents = [doc, doc2, doc3]
else:
envelope_definition.documents = [doc, doc2]
envelope_definition.recipients = recipients
envelope_definition.status = 'sent'
auth_api = AuthenticationApi()
envelopes_api = EnvelopesApi()
try:
login_info = auth_api.login()
login_accounts = login_info.login_accounts
base_url, _ = login_accounts[0].base_url.split('/v2')
api_client.host = base_url
docusign.configuration.api_client = api_client
envelope_summary = envelopes_api.create_envelope(login_accounts[0].account_id, envelope_definition=envelope_definition)
print(envelope_summary)
return 1
except ApiException as e:
raise Exception("Exception when calling DocuSign API: %s" % e)
except Exception as e:
print(e)
我希望将所有选项卡放置在适当位置的适当文档中,因为在添加第三个文档之前我没有遇到这个问题。但是,Title
和Printed Name
一样出现在每个单词所在的文档中。 Printed Name
和Title
和Date Signed
标签都同时出现在客户的印刷名称字段(标记为“印刷名称”)上。此外,带有Customer Signature
的文档中sign_here2
的{{1}}字段显示在document_id='2'
选项卡旁边。我在这里做什么错了?
答案 0 :(得分:2)
TL; DR-要求您的DocuSign技术联系人或客户服务将您的帐户的Anchor Scope
设置更新为document
,一切就绪。
锚文本搜索系统在信封中的所有文档中查找均被视为“功能”。
DocuSign具有帐户级别的设置,可以将帐户的Anchor Scope
设置从whole envelope
更改为document
。如果设置为document
,则documentId
将用于确定要搜索的锚字符串的文档。
只能由DocuSign更改设置。请与客户支持联系以进行更改。
使用锚文本的另一种模式是向文档添加其他文本。例如,/sn1/
标记第一个签名者的签名标签应该去的地方。
由于我们不想在文档本身中看到丑陋的文本字符串/sn1/
,因此常见的解决方法是为字符串/sn1/
使用白色,这样就不会在页面上看到。
如果可能有使用屏幕阅读器的签名者,则可以将其拼写出来,因为屏幕阅读器将忽略文本的颜色。例如/signer 1 signature area/
之类的东西(但请务必进行测试,有时空格会更改为PDF中的其他字符,而文本将不匹配。)
我已经提交了DocuSign内部增强请求EC-1150,以便可以通过API设置范围。如果您希望从此增强功能中受益,请要求您的DocuSign技术或业务联系人将组织的信息添加到故障单中。