Php 添加签名字段DocuSign
我正在使用curl-PHP方法创建一个Php 添加签名字段DocuSign,php,pdf,docusignapi,Php,Pdf,Docusignapi,我正在使用curl-PHP方法创建一个DocuSign信封。如何使用PHP将签名字段添加到pdf文档中 $headers = array( 'Content-Type: application/json', 'Authorization: Bearer '.$access_token->access_token ); $content_bytes = file_get_contents($_SERVER['DOCUMENT_ROOT'] .'/public
DocuSign
信封。如何使用PHP将签名字段添加到pdf文档中
$headers = array(
'Content-Type: application/json',
'Authorization: Bearer '.$access_token->access_token
);
$content_bytes = file_get_contents($_SERVER['DOCUMENT_ROOT'] .'/public/demo_documents/'.$docfile);
$doc3_b64 = base64_encode($content_bytes);
$document = array (
'documents' =>
array (
0 =>
array (
'documentBase64' => $doc3_b64,
'documentId' => 1,
'fileExtension' => 'pdf',
'name' => 'test '.$data['signer_name'],
"transformPdfFields"=> true
),
),
'emailSubject' => 'Test '.$data['signer_name'],
'recipients' =>
array (
'signers' =>
array (
0 =>
array (
'email' => $data['signer_email'],//signer email Here
'name' => $data['signer_name'],//signer Name Here
'recipientId' => '1',
),
),
),
'status' => 'sent',
);
$url = "https://demo.docusign.net/restapi/v2.1/accounts/$account_id/envelopes";
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS,json_encode($document));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$envelopes = json_decode(curl_exec($ch));
谢谢,但我的电子邮件停止使用上述代码。代码成功执行并生成信封,但没有电子邮件。修复了远程签名的代码,删除了一行(客户端用户id),现在它将再次发送电子邮件。因此,
$envelope\u definition
将作为Curl的参数传递?如下所示Curl\u setopt($ch,CURLOPT\u POSTFIELDS,json\u encode($envelope\u definition))代码>??按上述方式尝试,并创建了[status]=>信封,但未发送。可能是什么问题
# Create the signer recipient model
$signer = new Signer([ # The signer
'email' => $args['signer_email'], 'name' => $args['signer_name'],
'recipient_id' => "1", 'routing_order' => "1"
]);
# Create a sign_here tab (field on the document)
$sign_here = new SignHere([ # DocuSign SignHere field/tab
'anchor_string' => '/sn1/', 'anchor_units' => 'pixels',
'anchor_y_offset' => '10', 'anchor_x_offset' => '20'
]);
# Add the tabs model (including the sign_here tab) to the signer
# The Tabs object wants arrays of the different field/tab types
$signer->settabs(new Tabs(['sign_here_tabs' => [$sign_here]]));
# Next, create the top level envelope definition and populate it.
$envelope_definition = new EnvelopeDefinition([
'email_subject' => "Please sign this document sent from the PHP SDK",
'documents' => [$document],
# The Recipients object wants arrays for each recipient type
'recipients' => new Recipients(['signers' => [$signer]]),
'status' => "sent" # requests that the envelope be created and sent.
]);