xero icon indicating copy to clipboard operation
xero copied to clipboard

Generate & Download PDF of Invoice

Open dweep119 opened this issue 7 years ago • 0 comments

Hey I am trying your code to generate and download PDF of particular invoice ID, but I am facing some problem. My Code like this:-

var xero = new Xero(CONSUMER_KEY, CONSUMER_SECRET, RSA_PRIVATE_KEY); var invoiceId = xxxxxxxxxxxxxxxxxxxx; var req = xero.call('GET', '/Invoices/' + invoiceId);

req.setHeader('Accept', 'application/pdf'); req.on('response', function(response) { console.log("Response"); var file = fs.createWriteStream(invoiceId + '.pdf'); response.pipe(file); console.log("Response after cerateing File"); }); req.end();

Both console.log messages printed but doesn't return anything and Browser continuous loading. Is there any mistake?? How should I Download pdf of invoice??

dweep119 avatar Sep 22 '17 07:09 dweep119