Vinicius Martins
Vinicius Martins

Reputation: 83

How to download PDF file using PUPPETEER after form submit? NodeJS | PUPPETEER

I've been trying to download a PDF file using headless chrome. What I got to do is send a form with some info, on form submit it should download a PDF. How do I save this PDF? Obs: I'm using NodeJS as the framework.

Upvotes: 7

Views: 8796

Answers (1)

usuario
usuario

Reputation: 2467

I do not know exactly how the pdf is downloaded but I think you can use the following.

await page._client.send('Page.setDownloadBehavior', {behavior: 'allow', downloadPath: '/home/me/stuff'});

And then check for the file to be in the directory specified in the downloadPath property.

Upvotes: 15

Related Questions