Few questions on generate pdf file using wkhtmltopdf


#1

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.

  1. How generate pdf file only for login user.
  2. How add funcionality with allow generate pdf only login user
  3. Is there chance generate pdf in the file temlpate.html