'preview the document from a template using REST APIs

We have multiple templates each with a single document in DocuSign. For this we designed an interface in our application, listing all the templates. Before sending the selected templates (and the documents), is it possible to preview the document from the template (not a page image)?

NOTE: Have used RESTFul APIs.



Solution 1:[1]

You can access the PDF's stored in a template the same way you can download/access the PDF's within an envelope.

https://www.docusign.com/p/RESTAPIGuide/RESTAPIGuide.htm#REST%20API%20References/Get%20Template.htm?Highlight=template

Example GET URL for pulling the first document of a template: https://demo.docusign.net/restapi/v2/accounts//templates//documents/1

Solution 2:[2]

Use '/envelopes/{templateid}/documents/{documentid}' REST API call to get the response, then set headers before printing the response to preview in the browser.

example:

header('Content-type: application/pdf');
header('Content-Disposition: inline; filename="xyz.pdf"');
header('Content-Transfer-Encoding: binary');
header('Accept-Ranges: bytes');
print_r($response);//Print the response form the REST API.

Solution 3:[3]

You can use latest Docusign API v2.1

I'm using C# Docusign SDK Docusign SDK

templateApi.GetDocumentAsync(accountId, templateId, "combined") -- will get all the documents in one single file as Stream

or

templateApi.GetDocumentAsync(accountId, templateId, documentdId) -- get only the single document as Stream

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Luis Scott
Solution 2 Praveen
Solution 3 jayson.centeno