Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generate & Download PDF of Invoice #30

Open
dweep119 opened this issue Sep 22, 2017 · 0 comments
Open

Generate & Download PDF of Invoice #30

dweep119 opened this issue Sep 22, 2017 · 0 comments

Comments

@dweep119
Copy link

dweep119 commented Sep 22, 2017

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??

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant