Puppeteer is very heavy to be installed in the same container that laravel is running on. There is Docker-powered stateless API for PDF files called Gotenberg, it's doing the same thing, and it's working in separated container
Hello, I use spatie/browsershot for generating PDFs, but I have encountered some issues with it. When I use a simple view, it works normally. However, when I use a complex one, it fails. In this case, I added ->timeout(120), but it did not solve the overall problem. While it saved the PDF in the correct location, it returned a TimeoutError: Navigation timeout of 30000 ms exceeded. Could Anyone help?
The biggest issues we've run into with the Browsershot/Puppeteer setup on the server (we're running RedHat Enterprise) are 1) setting the correct node path (we use NVM); and 2) tricky permissions errors. For the first, we had to run "nvm use" and "which node" to find the owner, and then add a constant to .env "NODE_BIN=/home/[userName]/.nvm/versions/node/[version]/bin/". Paths will vary, of course. For the second, we had to change the owner of both the php-fpm process and the storage/* and bootstrap/* directories in Laravel. There's not a lot of clarity about which user needs to own these items in order for everything to work correctly.
The solution that worked for me was to create a symlink between /usr/local/bin/npm and /usr/local/bin/node to the corresponding paths for my binaries (can be found with which node, which npm). Only problem I see is if I update npm or node I will likely have to create new symlinks to the new paths. I assume your .env solution is the same, i.e. you will have to update the values for version when updating node. Since I am testing locally I had no permission errors but I can definitely see that being an issue when working on a remote server with several users.
I need help. I keep getting an error that "the command 'node: ....... Error Output === 'node' is not recorgnized as an internal or external command, operable program or batch' Everything is installed on windows. Any help
Whoa... so many moving parts. My initial reaction was "talk about treading mud into the dates of hell" buuuuuut... anything that can make PDFs easier, I am all for.
@@shadyarbzharothman8689 looks like we need to install node and npm on our computers and set the paths manually if needed. This package will not work on shared hosting websites.
They need to improve the documentation a lot since if you try to run the code for the first time, you will run into errors even if you're in localhost. It's becuz of Browershot needing node and puppeteer. You would need to add custom paths for node, npm and chrome. Even after all of that, I can't get it working becuz of puppeteer. There's no solutions regarding this problem
Worst thing Spatie has ever created. Generate PDF in Laravel with 15 easily breakable dependencies in frontend. Let alone the fact that the git discussions are filled with one and the same error. Spatie are usually a symbol of quality for Laravel, but this is terrible.
it doesn't work.. error said something about not being able to access node js internally and externally. I can access node js globally in all folder via cmd. Not sure why the error said otherwise. Tried on existing project and new project. I've also made sure to use the latest laravel n php version, as well as satisfying other requirements such as puppeteer and browsershot. Not working.
I have been using their spatie/browsershot package to generate invoices and its been fantastic. I imagine where before I had to first render the view then pass the html to the package now straight up passing the view is a great DX improvement. Kudos to the spatie team as always 👏
Yes the package supports arabic text - you can have it in the blade view as well as fetching it stored in a database such as MariaDB or MySQL and passing it through the controller to a blade view
I always follow your videos and it helped alot in code optimization. I am facing an issue in pdf generatin. I am trying to make a pdf using pdfdom that contains english and arabic, the english content displays corre tly but when it comes with arabic, it displays ????. can you pelase help me in this regard. i tried to include aeabic font as well but it didn't work