In laravel 5.8 app I use https://github.com/spatie/browsershot
and if I save file as
$save_to_file= 'file.pdf';
Browsershot::html(htmlspecialchars_decode($pdf_content))
->showBackground()
->save($save_to_file);
it is downloaded and saved in /public dir of my app at my local OS
If I try to set path to ‘Downloads’ directory of my Kubuntu 18 as
$save_to_file= '/home/currentuser/Downloads/file.pdf';
Browsershot::html(htmlspecialchars_decode($pdf_content))
->showBackground()
->save($save_to_file);
I got error:
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) If there is a way to download generated file into ‘Downloads’(OS independently) ?
2) I think that I can use php remove function but again how define ‘Downloads’(OS independently) directory ?
from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2NwOcXU
via IFTTT
Aucun commentaire:
Enregistrer un commentaire