Reputation: 83
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
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