Hi i use packages “iron:router”, “meteorhacks:npm” and npm packege “wkhtmltopdf” to generate pdf file with html page.
This is code use in router.js:
*this.route('pdfFile', {*
*where: 'server',*
*path: '/test.pdf',*
*action: function() {*
*var headers = {*
*'Content-type': 'application/pdf',*
*'Content-Disposition': "attachment; filename=test.pdf"*
*};*
*this.response.writeHead(200, headers);*
*var wk = Meteor.npmRequire('wkhtmltopdf');*
*var r = wk("http://10.11.12.13:3000/repertorium/insert").pipe(this.response);*
*}*
});
I have three questions for generate pdf file.
- How generate pdf file only for login user.
- How add funcionality with allow generate pdf only login user
- Is there chance generate pdf in the file temlpate.html