get pdf document
Tuesday, July 12, 2016 at 02:35amHi,
I want to get pdf document.
In POSTMAN
var request = require("request");
var options = { method: 'GET',
url: 'https://sandbox.esignlive.com/api/packages/{packageId}/documents/{documentId}/pdf',
headers:
{ 'postman-token': '731de084-90fd-c0ac-2fff-346723de7315',
'cache-control': 'no-cache',
'content-type': 'application/json',
accept: 'application/pdf',
authorization: 'Basic -----------------------------------------------------------==' } };
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
But I can't open the file. In foxit reader I found this error(Capture.png) and in chrome I found "Failed to load pdf document".
Also I use this in my app but found same error.
Please point out where I am wrong.
----------
Regards
Zeeshan hanif
Reply to: get pdf document
Tuesday, July 12, 2016 at 06:11amvar options = { method: 'GET', url: 'https://sandbox.esignlive.com/api/packages/fF-ri8cOGtm6YzzhzdOYDJVtRF0=/documents/f8629acded9734a1/pdf', headers: { accept: 'application/pdf', authorization: 'Basic api_key' }, }; request(options).pipe(fs.createWriteStream('./something.pdf'));If you want to test this on postman, all you have to do is click on the arrow next to "Send" and select "Send and Download". See my attachment. Hope this helps :)Reply to: get pdf document
Tuesday, July 12, 2016 at 09:21amReply to: get pdf document
Tuesday, July 12, 2016 at 10:57am