DEV Community

Cover image for How to make screenshots in Laravel with Browsershot

How to make screenshots in Laravel with Browsershot

Kuberdenis on April 28, 2022

Introduction Browsershot is a software by Spatie that converts a webpage into an image or PDF by utilising a headless instance of Chrome...
Collapse
 
bobbyiliev profile image
Bobby Iliev

Great post! Super cool to see some Laravel content by you! πŸš€

Collapse
 
kubeden profile image
Kuberdenis

πŸ™Œ πŸ™

Collapse
 
jeenus14 profile image
blaster

Hi bro. My application always shows this:
Symfony\Component\Process\Exception\ProcessFailedException: The command "node ^"C:^\xampp^\htdocs^\NFT-Plus-Phase-2^\vendor^\spatie^\browsershot^\src/../bin/browser.js^" ^"^{^^"url^^":^^"https:^\/^\/google.com^^",^^"action^^":^^"screenshot^^",^^"options^^":^{^^"type^^":^^"png^^",^^"path^^":^^"test^\/googlescreenshot.jpg^^",^^"args^^":^[^],^^"viewport^^":^{^^"width^^":3840,^^"height^^":2160^},^^"landscape^^":true,^^"waitUntil^^":^^"networkidle0^^"^}^}^"" failed.

Exit Code: 1(General error)

Working directory: C:\xampp\htdocs\NFT-Plus-Phase-2\public

Output:

Error Output:

'node' is not recognized as an internal or external command,
operable program or batch file.
in file C:\xampp\htdocs\NFT-Plus-Phase-2\vendor\spatie\browsershot\src\Browsershot.php on line 862

Collapse
 
isaac97 profile image
をむアック

->setNodeBinary($path_to_node)

Collapse
 
merite15 profile image
Merite15

I'm on windows machine and i have this error For some reason Chrome did not write a file at test.pdf. Command ======= [] Output ======
Image description