0

我正在尝试创建多个文档,并且我在 envelop_definition 数组中获取了完整的文档,但是当它生成文档信封时,它只显示第一个。

我需要做什么?

我将以下代码用于多个文档。

$docs = array();
                    $b=1;
                    foreach ($fileArray as $key => $file) {

                    // Add a document to the envelope
                    $document = new DocuSign\eSign\Model\Document();
                    $document->setDocumentBase64(base64_encode(file_get_contents($file)));
                    $document->setName('Document '.$b);
                    $document->setDocumentId($b);
                    $document->setOrder($b);
                    $docs[] = $document;
                        # code...
                    $b++;
                    }





    $envelop_definition->setDocuments($docs);
            $envelop_definition->setTemplateRoles($all_template_roles);

            // send notification about status change 
            $envelop_definition->setEventNotification($event_notification);
            // set envelope status to "sent" to immediately send the signature request
            $envelop_definition->setStatus("sent");

$envelopeApi->createEnvelope($accountId, $envelop_definition, $options);

但只得到第一个文件。

4

1 回答 1

0

您对templateRoles对象的使用意味着您正在尝试创建一个使用已创建模板的信封。

如果是这种情况,则不要使用 Document 模型将文档添加到信封/模板中。

相反,您将模板中的文档和文档组合在一起。

如果要将文档添加到模板中已有的文档集中,请参阅eg013AddDocToTemplate.sh以获取代码示例。该示例还提供多种语言版本。PHP 正在生产中。

如果您要用新文档替换模板中已有的文档,请参阅此答案

于 2018-12-02T07:27:35.727 回答