发送前在 Docusign 文档中预填 PDF 表单字段(transform_pdf_fields == true)

Prefill PDF form field in Docusign document before sending (transform_pdf_fields == true)

我正在使用 Docusign PHP SDK 使用带有预先存在的表单字段的 PDF 创建信封。

Docusign 正确解析了字段并显示在生成的文档中。

但是,我找不到预填充其中一些字段的方法。

    // Create document model
    $document = new Document([
        'document_base64' => $base64_content,
        'name' => 'Document',
        'file_extensions' => 'pdf',
        'document_id' => 1, 'transform_pdf_fields' => true
    ]);

    $signer = new Signer([
        'email' => $args['client_email'],
        'name' => $args['client_name'],
        'recipient_id' => 1,
        'routing_order' => 1,
        'client_user_id' => $args['client_user_id']
    ]);

    // This is the attempt to prefill the fields
    // by using the same label as the PDF form.
    // But it does nothing.
    $text1 = new Text([
        'tab_label' => 'field_one', 'value' => $args['client_coverage'],
    ]);
    $text2 = new Text([
        'tab_label' => 'field_two', 'value' => $args['client_term'],
    ]);
    $signer->setTabs(new Tabs(['text_tabs' => [$text1, $text2]]));

    $definition = new EnvelopeDefinition([
        'email_subject' => "Please sign this document",
        'documents' => [$document],
        'recipients' => new Recipients(['signers' => [$signer]]),
        'status' => 'sent',
    ]);

调用信封选项卡 API 显示有问题的选项卡具有准确的选项卡标签,但值为空白。

如有任何建议,我们将不胜感激!谢谢

P.S。我可以在创建信封后获取文档选项卡,以获取它们的 ID,然后再次请求更新这些选项卡。
所以这在 3 个调用中是可行的,但我觉得应该可以在一个调用中完成 - 当最初创建信封时。

@sdragnev,如果你使用复合模板,这可以工作

$inline_template = new \DocuSign\eSign\Model\InlineTemplate([
    'recipients' => new Recipients(['signers' => [$signer]]),  
    'sequence' => "1" 
    ]);
$inline_templates = [$inline_template];
$composite_template = new \DocuSign\eSign\Model\CompositeTemplate([
    'composite_template_id' => "1",  
    'document' => $document,  
    'inline_templates' => $inline_templates
    ]);
$composite_templates = [$composite_template];
$envelope_definition = new \DocuSign\eSign\Model\EnvelopeDefinition([
    'composite_templates' => $composite_templates,  
    'email_subject' => "Agreement",  
    'status' => "sent" 
    ]);