表格提交后如何使用PUPPETEER下载PDF文件? NodeJS |木偶 [英] How to download PDF file using PUPPETEER after form submit? NodeJS | PUPPETEER
本文介绍了表格提交后如何使用PUPPETEER下载PDF文件? NodeJS |木偶的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我一直在尝试使用无头的chrome下载PDF文件.我要做的是发送带有一些信息的表单,在表单提交时应下载PDF.如何保存此PDF? Obs:我正在使用NodeJS作为框架.
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.
推荐答案
我不完全知道pdf的下载方式,但我认为您可以使用以下内容.
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'});
然后检查文件是否在downloadPath属性中指定的目录中.
And then check for the file to be in the directory specified in the downloadPath property.
这篇关于表格提交后如何使用PUPPETEER下载PDF文件? NodeJS |木偶的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文