2016-06-24 12 views
0

私はDocuSignで開発者アカウントを作成しましたが、明らかに、封筒に添付する必要がある文書にHTMLテンプレートを使用できるかどうかを知る必要があります。このためにREST APIを使用する予定です。しかし、私はそれが可能かどうかを知りたいと思います。文書から見ることのできるのは、PDFとテンプレートジェネレータだけです。REST APIのHTMLを使用してDocusignテンプレートを作成することはできますか?

私の目標は、アプリケーションからそのテンプレート(HTML)をオンザフライで生成し、それをテンプレートとしてAPIに送信することです。

本当にありがとうございます。

ありがとうございます。

+0

「HTMLテンプレート」とはどういう意味ですか? DocuSignテンプレートは、アカウントに存在するドキュメント、受信者、タブなどのサーバーサイドオブジェクトです。クラシックUIを使用してテンプレート定義をダウンロードすると、それがXML形式であることがわかります。すべてのことを言っておけば、あなたのアプリはそのことを意味するものであればすぐにドキュメントを生成できます。 – Ergin

+0

以下の例では、HTMLコンテンツをDocuSignに送信し、努力 - あなたのコンテンツはPDFに変換されることに注意してください。さまざまなHTMLプロパティの変換とサポートには、(自分の過去の経験から)制限がありますが、標準のHTMLコンポーネントの大半はサポートされるべきです。 –

+0

yupありがとう、thats私はHTMLテンプレートを渡して、それをpdfに隠すことができたと思った。 –

答えて

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があります。

関連する問題