【问题标题】:Docusign single signer but multiple signatures on documentDocusign 单个签名者,但文档上有多个签名
【发布时间】:2017-01-20 21:52:57
【问题描述】:

我正在使用 Docusign php api。我正在通过这个 api 签署文件。一切安好 。但现在我需要多个地方的收件人签名。我不知道我需要签名多少次,即使我不知道我需要签名选项卡的位置,我只是在 html 文档中有一个占位符,那就是 #\b 。我必须把签名标签放在#\b

// create a new DocuSign configuration and assign host and header(s)
    $config = new DocuSign\eSign\Configuration();
    $config->setHost($host);
    $config->addDefaultHeader("X-DocuSign-Authentication", "{\"Username\":\"" . $username . "\",\"Password\":\"" . $password . "\",\"IntegratorKey\":\"" . $integrator_key . "\"}");
    /////////////////////////////////////////////////////////////////////////
    // STEP 1:  Login() API
    /////////////////////////////////////////////////////////////////////////
    // instantiate a new docusign api client
    $apiClient = new DocuSign\eSign\ApiClient($config);
    // we will first make the Login() call which exists in the AuthenticationApi...
    $authenticationApi = new DocuSign\eSign\Api\AuthenticationApi($apiClient);
    // optional login parameters
    $options = new \DocuSign\eSign\Api\AuthenticationApi\LoginOptions();
    // call the login() API
    $loginInformation = $authenticationApi->login($options);
    // parse the login results
    if(isset($loginInformation) && count($loginInformation) > 0)
    {
        // note: defaulting to first account found, user might be a 
        // member of multiple accounts
        $loginAccount = $loginInformation->getLoginAccounts()[0];
        if(isset($loginInformation))
        {
            $accountId = $loginAccount->getAccountId();
        }
    }
    if(empty($accountId))
    {
        return false;
    }
    /////////////////////////////////////////////////////////////////////////
    // STEP 2:  Create & Send Envelope (aka Signature Request)
    /////////////////////////////////////////////////////////////////////////
    // set recipient information

    // instantiate a new envelopeApi object
    $envelopeApi = new DocuSign\eSign\Api\EnvelopesApi($apiClient);
    // Add a document to the envelope
    $document = new DocuSign\eSign\Model\Document();
    $document->setDocumentBase64(base64_encode(file_get_contents($documentFileName)));
    $document->setName($documentName);
    $document->setDocumentId("1");
    // Create a |SignHere| tab somewhere on the document for the recipient to sign
    $signHere = new \DocuSign\eSign\Model\SignHere();
    $signHere->setXPosition("20");
    $signHere->setYPosition("20");
    $signHere->setDocumentId("1");
    $signHere->setPageNumber("1");
    $signHere->setRecipientId("1");

   // add the signature tab to the envelope's list of tabs
    $tabs = new DocuSign\eSign\Model\Tabs();
    $tabs->setSignHereTabs(array($signHere));
    // add a signer to the envelope
    $signer = new \DocuSign\eSign\Model\Signer();
    $signer->setEmail($recipientEmail);
    $signer->setName($recipientName);
    $signer->setRecipientId("1");
    $signer->setClientUserId('12345');
    $signer->setTabs($tabs);
    // Add a recipient to sign the document
    $recipients = new DocuSign\eSign\Model\Recipients();
    $recipients->setSigners(array($signer));
    $envelop_definition = new DocuSign\eSign\Model\EnvelopeDefinition();
    $envelop_definition->setEmailSubject("Please sign this doc");
    // set envelope status to "sent" to immediately send the signature request
    $envelop_definition->setStatus("sent");
    $envelop_definition->setRecipients($recipients);
    $envelop_definition->setDocuments(array($document));
    // create and send the envelope! (aka signature request)
    $envelop_summary = $envelopeApi->createEnvelope($accountId, $envelop_definition, null);
    if($envelop_summary)
    {
        $document=json_decode($envelop_summary);
        $envloped=$document->envelopeId;
        // get the document url 
        $ReturnUrl=add_query_arg(array('action'=>'docusign_request','_uid'=>$formprocess,'_envelopid'=>$envloped),get_permalink());

        $viewrequest = new DocuSign\eSign\Model\RecipientViewRequest();
        $viewrequest->setUserName($recipientName); 
        $viewrequest->setEmail($recipientEmail);
        $viewrequest->setRecipientId(1);
        $viewrequest->setClientUserId('12345');
        $viewrequest->setAuthenticationMethod('email');
        $viewrequest->setReturnUrl($ReturnUrl);
        $envelopview=$envelopeApi->createRecipientView($accountId,$document->envelopeId,$viewrequest);
        $redirecturl=$envelopview->getUrl();
        wp_redirect($redirecturl);
        // get the doc url
    } 

【问题讨论】:

    标签: php docusignapi


    【解决方案1】:

    您应该为此目的使用 Docusign Anchor 选项卡

    https://github.com/docusign/docusign-soap-sdk/wiki/Code-Walkthrough-_-Anchor-Tabs

    锚标签是一个解决方案。由于 Anchor Tab 通过匹配文档文本中存在的字符串来工作,因此我们只需要检查文档并查看是否有合适的文本。许多合同的文档上都印有“Sign Here”之类的内容,因此我们可以将其用作锚文本,然后 DocuSign 会在文档上找到“Sign Here”文本的任何地方放置一个签名选项卡。

    // Create a |SignHere| tab somewhere on the document for the recipient to sign
    $signHere = new \DocuSign\eSign\Model\SignHere();
    $signHere->setDocumentId("1");
    $signHere->setPageNumber("1");
    $signHere->setRecipientId("1");
    
       $signHere->AnchorTabItem->AnchorTabString = "#\b";
       $signHere->AnchorTabItem->Unit = "Pixels";
       $signHere->AnchorTabItem->XOffset = 50;
       $signHere->AnchorTabItem->YOffset = 100;
       $signHere->AnchorTabItem->IgnoreIfNotPresent = true;
    

    【讨论】:

    • 我不知道我需要签名多少次,即使我不知道我需要签名选项卡的位置,我只是在 html 文档中有一个占位符,那就是#\乙。我必须将签名选项卡放在#\b 的位置
    • 您转换的文档是否包含文本#\b 或其他内容?您可以尝试设置 IgnoreIfNotPresent=false 并查看它是否会引发错误。这意味着您要查找的锚文本不在文档中。
    • 我正在将文本转换为 PDF,然后将此 pdf 文本添加到 document 中。是的,文档中有文本。
    • 您是否能够验证创建的选项卡数量。您可以为此使用 GetTabs API。
    • @mkd 你能发布你的 HTML 吗?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-06-10
    相关资源
    最近更新 更多