laravel DocuSign:在此处插入多个符号每个锚字符串上的制表符

anauzrmj  于 2023-06-30  发布在  其他
关注(0)|答案(1)|浏览(72)

这是我在laravel中使用docusign API构建信封的代码。我在信封中动态发送文档,并在给定的锚字符串上放置签名标签。这是我的代码。

private function buildEnvelope($envelopeFiles, $user): EnvelopeDefinition 
{
 $recipientEmail = $user->email; $recipientName = $user->first_name . " " . $user->last_name; 
   
// Create an array to store all CompositeTemplate objects
    $compositeTemplates = [];
    foreach ($envelopeFiles as $index => $documentPath) {
        $fileContent = file_get_contents($documentPath);
        $fileName = pathinfo($documentPath, PATHINFO_BASENAME);
        $fileExtension = pathinfo($documentPath, PATHINFO_EXTENSION);

        // Create a Document object for the current document
        $document = new Document([
            'document_base64' => base64_encode($fileContent),
            'name' => $fileName,
            'file_extension' => $fileExtension,
            'document_id' => $index + 1,
        ]);

        // Create a SignHere tab for the current document on anchor string "Initials"
        $signHereTab = new SignHere([
            'document_id' => $index + 1,
            'page_number' => 1,
            'recipient_id' => '1',
            'anchor_string' => 'Initials',
            'tab_label' => 'Sign Here',
            'anchor_x_offset' => '40',
            'anchor_y_offset' => '0',
            // 'x_position' => '70',
            // 'y_position' => '780'
        ]);

        // Create a Tabs object for the current document with the SignHere tab
        $tabs = new Tabs([
            'sign_here_tabs' => [$signHereTab],
        ]);

        // Create a Signer object for the recipient with the Tabs object
        $recipient = new Signer([
            'email' => $recipientEmail,
            'name' => $recipientName,
            'recipient_id' => '1',
            'routing_order' => '1',
            'tabs' => $tabs,
        ]);

        // Create an InlineTemplate object for the current document with the recipient
        $recipients = new Recipients(['signers' => [$recipient]]);
        $inlineTemplate = new InlineTemplate([
            'sequence' => $index + 1,
            'recipients' => $recipients,
        ]);

        // Create a CompositeTemplate object for the current document with the Document
        $compositeTemplate = new CompositeTemplate([
            'inline_templates' => [$inlineTemplate],
            'document' => $document,
        ]);

        // Add the CompositeTemplate object to the array of CompositeTemplate objects
        $compositeTemplates[] = $compositeTemplate;
    }

    // Create the EnvelopeDefinition object with all the CompositeTemplate objects and other settings
    $envelopeDefinition = new EnvelopeDefinition([
        'composite_templates' => $compositeTemplates,
        'email_subject' => "Please sign the documents",
        'status' => "sent",
    ]);

    return $envelopeDefinition;
}

当我发送一个文档时,它工作正常,但当我发送多个文档时,问题就出现了。当我尝试发送多个文档时,sign here选项卡插入的数量等于每个锚字符串上的文档数量。如果我发送2个文档进行签名,则在每个锚字符串上插入2个sign here选项卡,如果我发送3个文档,则插入3个sign here选项卡,依此类推。我只想要一个标志在这里每个锚字符串标签。有人能帮我吗?

jm81lzqq

jm81lzqq1#

您需要联系DocuSign客户支持以更改帐户的锚选项卡范围。该范围控制是在整个信封上还是在单个文档上搜索字符串。您不能自己更改它,只有通过联系支持才能更改选项卡填充范围(与支持人员交谈时使用此术语)。

相关问题