我已经在我的 laravel 项目中安装了 browsershot 我已经安装了 puppeteer,安装了 chromium,我的 npm 版本已更新,但我仍然无法获取我的简单 html 输入的 PDF,我尝试通过 URL 方法截屏并保存为图像(它有效),但我的要求是生成我的 html 的 PDF。
这是我在控制器中的代码
$output=Browsershot::html($html)
->setNodeModulePath("/var/www/html/ProjectName/node_modules/")
->setChromePath("/usr/bin/chromium-browser")
->setNodeBinary('/usr/local/bin/node')
->setNpmBinary('/usr/local/bin/npm')
->showBackground()
->noSandbox()->timeout(60)
->save(public_path("DevTest.pdf");
错误信息:
"message": "进程"PATH=$PATH:/usr/local/bin NODE_PATH='/var/www/html/ProjectName/node_modules/'/usr/local/bin/node'/var/www/html/ benesprint/vendor/spatie/browsershot/src/../bin/browser.js''{"url":"file:\/\/\/tmp\/1933874416-0068512001600765779\/index.html","action" :"pdf","options":{"path":"\/var\/www\/html\/ProjectName\/public\/DevTest.pdf","args":["--no-sandbox"] ,"viewport":{"width":800,"height":600},"displayHeaderFooter":false,"executablePath":"\/usr\/bin\/chromium-browser","timeout":60000," printBackground":true}}'" 超过了 60 秒的超时时间。",
**i would be grateful if you can help me out.**