I am using BrowserShot to convert HTML to PDF. When I saved pdf file on storage disk I am facing following problem.
The command "PATH=$PATH:/usr/local/bin NODE_PATH=`npm root -g` node '/home/irshad/Desktop/projects/seller-suite/vendor/spatie/browsershot/src/../bin/browser.js' '{"url":"file:\/\/\/tmp\/146500948-0992198001603349147\/index.html","action":"pdf","options":{"args":[],"viewport":{"width":800,"height":600},"displayHeaderFooter":false,"margin":{"top":"18mm","right":"18mm","bottom":"24mm","left":"18mm"},"format":"A4","printBackground":true}}'" failed. Exit Code: 1(General error) Working directory: /home/irshad/Desktop/projects/seller-suite/public Output: ================ Error Output: ================ { TimeoutError: Navigation timeout of 30000 ms exceeded at Promise.then (/home/irshad/Desktop/projects/seller-suite/node_modules/puppeteer/lib/cjs/puppeteer/common/LifecycleWatcher.js:106:111) name: 'TimeoutError' }
I am using code to convert HTML to PDF
$save_to_file= storage_path('example.pdf');
$pdf_file = Browsershot::html($html)
->margins(18, 18, 24, 18)
->format('A4')
->showBackground()
->pdf();
$invoice = response()->stream(function () use ($pdf_file) {
echo $pdf_file->pdf();
}, 200, ['Content-Type' => 'application/pdf']);
How can i solve it i have waste alot of time on it. Thanks