3

In puppeteer, I am trying to download the invoice. when I click on download button, it opens the print preview dialogue. Is there a way to save the pdf from print preview window?

The content inside print preview is not same as page that rendered, if that is the case i would use puppeteer page to pdf. but content is generated on fly and goes to print preview.

Please help me to download the pdf

Mallikarjun
  • 158
  • 9
  • Need to see how exactly that PDF is generated. E.g. if there's a simple link you click you could get a URL by puppeteer and then make a request to download that PDF from node side. Would you provide any link to the website you trying to scrape? – Antonio Narkevich Jun 24 '18 at 11:02
  • I have the same issue with printing ms form responses. If anyone fine a way I'd be happy to vote for him – ClearBoth Jan 02 '21 at 05:18

1 Answers1

0

You can use the page.pdf() method in Puppeteer instead of clicking the button.

That's the same as saving a PDF from the print preview dialogue.

Documentation: https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions