【问题标题】:Is it possible to create a Docusign template using HTML from the REST API?是否可以使用来自 REST API 的 HTML 创建 Docusign 模板?
【发布时间】:2016-06-25 16:22:11
【问题描述】:

我刚刚使用 DocuSign 创建了我的开发者帐户,显然我需要知道是否可以将 HTML 模板用于需要附加到信封的文档。我打算为此使用 REST API。但我想知道是否有可能,我从您的文档中看到的只有 PDF 和模板生成器。

我的目标是从我的应用程序中即时生成模板 (HTML) 并将其作为模板发送到 API。

任何帮助将不胜感激。

提前致谢。

【问题讨论】:

  • “HTML 模板”是什么意思? DocuSign 模板是存在于您帐户中的服务器端对象,它们包含文档、收件人、选项卡和其他信息。如果您下载模板定义(使用经典 UI),您会看到它是 XML 格式。说了这么多,您的应用程序可以动态生成文档,如果这就是您的意思,并使用这些文档和数据等实时创建信封
  • 根据您下面的示例,是的,您可以将 HTML 内容发送到 DocuSign 并尽最大努力 - 请记住,您的内容将被转换为 PDF。尽管应该支持大部分标准 HTML 组件,但各种 HTML 属性的转换和支持确实有限制(根据我自己过去的经验)。
  • 是的,谢谢,这就是我想要传递 HTML 模板并将其转换为 pdf 的全部内容。

标签: docusignapi


【解决方案1】:

最后,我能够使用 PHP SDK 实现这一目标。如果你们有兴趣知道这里是如何。

// set recipient information
$recipientName = "";
$recipientEmail = "";

// configure the document we want signed
$documentFileName = "/../document.html";
$documentName = "document.html";

// instantiate a new envelopeApi object
$envelopeApi = new DocuSign\eSign\Api\EnvelopesApi($this->getApiClient());

// Add a document to the envelope
$document = new DocuSign\eSign\Model\Document();
$document->setDocumentBase64(base64_encode(file_get_contents(__DIR__ . $documentFileName)));
$document->setName($documentName);
$document->setFileExtension('html');
$document->setDocumentId("2");

// Create a |SignHere| tab somewhere on the document for the recipient to sign
$signHere = new \DocuSign\eSign\Model\SignHere();
$signHere->setXPosition("100");
$signHere->setYPosition("100");
$signHere->setDocumentId("2");
$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->setTabs($tabs);
$signer->setClientUserId("1234");  // must set this to embed the recipient!

// 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("[DocuSign PHP SDK] - 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);
echo "$envelop_summary\n";

在我深入研究他们的文档之后。这是source

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-08-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-02-08
    相关资源
    最近更新 更多