node-html-pdf icon indicating copy to clipboard operation
node-html-pdf copied to clipboard

How to change the page title and pdf title?

Open ysd-wilson opened this issue 3 years ago • 1 comments

Currently the page title and pdf title use the end of url segment by default. How to change them? I have tried title tag in head but not working. Screenshot 2022-03-21 at 10 58 14 AM

Here my code:

   pdf.create(html).toStream(function(err, stream){
      if (err) return res.end(err.stack)
      res.setHeader('Content-Type', 'application/pdf')
      res.setHeader('Content-Disposition', 'filename=my_filename.pdf')
      stream.pipe(res)
    });

ysd-wilson avatar Mar 21 '22 03:03 ysd-wilson

Currently the page title and pdf title use the end of url segment by default. How to change them? I have tried title tag in head but not working. Screenshot 2022-03-21 at 10 58 14 AM

Here my code:

   pdf.create(html).toStream(function(err, stream){
      if (err) return res.end(err.stack)
      res.setHeader('Content-Type', 'application/pdf')
      res.setHeader('Content-Disposition', 'filename=my_filename.pdf')
      stream.pipe(res)
    });

I have the same problem, did you find any solution?

dav-q avatar Nov 21 '22 16:11 dav-q