在laravel 5.8应用程序中,我使用https://github.com/spatie/browsershot
并且如果我将文件另存为
$save_to_file= 'file.pdf';
Browsershot::html(htmlspecialchars_decode($pdf_content))
->showBackground()
->save($save_to_file);
已在本地操作系统上下载并保存在我的应用程序的/ public目录中
如果我尝试将Kubuntu 18的“下载”目录设置为以下路径,则为>
$save_to_file= '/home/currentuser/Downloads/file.pdf'; Browsershot::html(htmlspecialchars_decode($pdf_content)) ->showBackground() ->save($save_to_file);
我有错误:
Symfony \ Component \ Process \ Exception \ ProcessFailedException The command "PATH=$PATH:/usr/local/bin NODE_PATH=`npm root -g` node '/mnt/_work_sdb8/wwwroot/lar/votes/vendor/spatie/browsershot/src/../bin/browser.js' '{"url":"file:\/\/\/tmp\/0906513001561868598\/index.html","action":"pdf","options":{"path":"\/home\/serge\/Downloads\/file.pdf","args":[],"viewport":{"width":800,"height":600},"displayHeaderFooter":false,"printBackground":true}}'" failed. Exit Code: 1(General error) Working directory: /mnt/_work_sdb8/wwwroot/lar/votes/public Output: ================ Error Output: ==============
1)是否可以将生成的文件下载到“ Downloads”(独立于OS)?
2)我认为我可以使用php remove功能,但还是要如何定义“ Downloads”(独立于OS)目录?
在laravel 5.8应用程序中,我使用https://github.com/spatie/browsershot,如果我将文件另存为$ save_to_file ='file.pdf'; Browsershot :: html(htmlspecialchars_decode($ pdf_content))-> ...
我收到了完全相同的错误。不知道为什么我明白了。遵循了文档中提到的所有步骤。尝试过的各种资源仍然无法弄清。