New Spatie PDF Package: Use Tailwind Styles in PDF

  Рет қаралды 12,999

Laravel Daily

Laravel Daily

Күн бұрын

Presenting another new package by Spatie.
Links mentioned in the video:
- Official repo: github.com/spatie/laravel-pdf
- Official tutorial: "Easily create PDFs in Laravel apps" freek.dev/2625-easily-create-...
- Tutorial "Creating beautiful invoices using Tailwind and Laravel PDF" freek.dev/2639-creating-beaut...
- Resume example: resume.joe.codes/
- - - - -
Support the channel by checking out my products:
- My Laravel courses: laraveldaily.com/courses
- Filament examples: filamentexamples.com
- Livewire Kit Components: livewirekit.com
- - - - -
Other places to follow:
- My weekly Laravel newsletter: us11.campaign-archive.com/hom...
- My personal Twitter: / povilaskorop

Пікірлер: 71
@mitanomar
@mitanomar 5 ай бұрын
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
@ricko13
@ricko13 5 ай бұрын
good to know
@silphium5510
@silphium5510 5 ай бұрын
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.
@xyczz
@xyczz 5 ай бұрын
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.
@rationalityfirst
@rationalityfirst 5 ай бұрын
Yay, node dependencies in production for a PHP site! The fun we missed.
@SXsoft99
@SXsoft99 5 ай бұрын
been using them for some years
@Samuel.Mwangi
@Samuel.Mwangi 5 ай бұрын
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 👏
@ssodoloufo
@ssodoloufo Ай бұрын
Not work on windows. How to fixe it ?
@adamyulian8664
@adamyulian8664 5 ай бұрын
Thanks is exactly what I need
@8infinito8
@8infinito8 5 ай бұрын
Absolutely amazing 😍. Styling PDF with Tailwind CSS it seems a miracle to me!
@stefanrakic5991
@stefanrakic5991 5 ай бұрын
Looks great, but it's very tricky to install Puppeter on some linux servers
@1234matthewjohnson
@1234matthewjohnson 5 ай бұрын
still using the snappy :) works great
@403gtfo
@403gtfo 5 ай бұрын
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.
@vidhyaprakash85
@vidhyaprakash85 5 ай бұрын
thanks... Just now i started to work
@Novia5555
@Novia5555 5 ай бұрын
Nice Info 👍🏻👍🏻
@MishaAkopov
@MishaAkopov 5 ай бұрын
Finally! Great news
@JUSTaGUYchannel
@JUSTaGUYchannel 3 ай бұрын
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
@shadyarbzharothman8689
@shadyarbzharothman8689 2 ай бұрын
Did you solve the problem?
@yu5uy
@yu5uy 5 ай бұрын
Thanks
@SanderCokart
@SanderCokart 5 ай бұрын
This is huge
@tal.gerafi
@tal.gerafi 5 ай бұрын
What about implementing tables, images, page breaks, big tables maybe with images? I think those are the main issues
@krekas
@krekas 5 ай бұрын
Page bake you can definitely do, there's a helper. Images should be a breeze. Should read the docs
@amir-raouaa
@amir-raouaa 5 ай бұрын
Have you a proposal how to use it with Filament?
@comemballage
@comemballage 4 ай бұрын
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?
@othmantabati3757
@othmantabati3757 5 ай бұрын
do i have to install the chrome binaries on the server for this package to work ?
@VirusEcks
@VirusEcks 5 ай бұрын
unfortunately yes so it wouldn't work on shared hosting
@krekas
@krekas 5 ай бұрын
when using laravel shared hosting shouldn't be used in first place
@anuzpandey1053
@anuzpandey1053 5 ай бұрын
Can you elaborate more on why is it bad practice to host laravel on shared hosting. @@krekas
@DarellND
@DarellND 4 ай бұрын
I always get "'node' is not recognized as an internal or external command, operable program or batch file." whenever I try saving the pdf. 🤔
@shadyarbzharothman8689
@shadyarbzharothman8689 2 ай бұрын
Did you solve the problem?
@DarellND
@DarellND 2 ай бұрын
@@shadyarbzharothman8689 yes. I needed to install nodejs globally. This package will not work on shared hosting.
@DarellND
@DarellND 2 ай бұрын
@@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.
@imranafzal02
@imranafzal02 5 ай бұрын
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
@LaravelDaily
@LaravelDaily 5 ай бұрын
Sorry I haven't used dompdf with arabic
@alirezabazargani1360
@alirezabazargani1360 4 ай бұрын
set utf-8 meta tag in your view.
@uluumbch
@uluumbch 5 ай бұрын
so basically that's just image right? I mean the text cannot be select and copy-paste?
@pilskalns
@pilskalns 5 ай бұрын
No, it is a text. Open the resume page link from video description.
@abhishekbhagat9313
@abhishekbhagat9313 5 ай бұрын
It throws some error, saying issue with puppeter, even after trying to install it and its the same
@LaravelDaily
@LaravelDaily 5 ай бұрын
Then it's probably something with your web server
@abhishekbhagat9313
@abhishekbhagat9313 5 ай бұрын
@@LaravelDaily actually when i am trying to work on local
@alirezabazargani1360
@alirezabazargani1360 4 ай бұрын
@@abhishekbhagat9313your app is serving via a webserver even on local machine, too. so you need to set env of yours to be compatible.
@ssodoloufo
@ssodoloufo Ай бұрын
How can make it work in windows or ubuntu ?
@azeroth5672
@azeroth5672 5 ай бұрын
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.
@shadyarbzharothman8689
@shadyarbzharothman8689 2 ай бұрын
Did you solve the problem?
@AbderrahmanFodili
@AbderrahmanFodili 5 ай бұрын
I wonder if it supports RTL
@krekas
@krekas 4 ай бұрын
Why wouldn't it?
@nipunsachinda
@nipunsachinda 5 ай бұрын
can i use with boostrap?
@krekas
@krekas 4 ай бұрын
Yes
@nabih.siblini
@nabih.siblini 5 ай бұрын
is it supporting arabic text?
@xyczz
@xyczz 5 ай бұрын
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
@Anonymous-cj4kk
@Anonymous-cj4kk 5 ай бұрын
The Arabic language also works perfectly
@muhammadrafay3021
@muhammadrafay3021 5 ай бұрын
Can you show how to automatically backup a big database every day with Laravel on cPanel? Make a video, please!
@LaravelDaily
@LaravelDaily 5 ай бұрын
I don't use cpanel, sorry
@muhammadrafay3021
@muhammadrafay3021 5 ай бұрын
​@@LaravelDaily make overall large db backup . thank you
@krekas
@krekas 5 ай бұрын
use spatie backup package. that is all
@grzesiekb9142
@grzesiekb9142 5 ай бұрын
Unfortunately, I won't run this package on my VPS :(
@astrea4231
@astrea4231 Ай бұрын
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
@lindor94
@lindor94 Ай бұрын
Same here, after setting the paths, I still cant get get it running on Ubuntu 20.
@wildfireDZ
@wildfireDZ 5 ай бұрын
5 seconds for one page pdf is kinda long
@alirezabazargani1360
@alirezabazargani1360 4 ай бұрын
make a command to run in background.
@lindor94
@lindor94 Ай бұрын
Thats what I taught, then I tried generating a table with 10.000 rows and it took maybe 20-25 seconds.
@SXsoft99
@SXsoft99 5 ай бұрын
i can finally stop declaring styles for pdf
@g.o.3262
@g.o.3262 5 ай бұрын
The worst thing about all those PDF creation packages is their slow speed. Good luck generating 100k documents…
@alirezabazargani1360
@alirezabazargani1360 4 ай бұрын
background commands.
@maximilianberbechelov
@maximilianberbechelov 4 ай бұрын
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.
14 Quick Laravel Tips in 9 Minutes: May 2024
9:09
Laravel Daily
Рет қаралды 9 М.
Laravel Security: Top 7 Mistakes Developers Make
11:16
Laravel Daily
Рет қаралды 81 М.
Please be kind🙏
00:34
ISSEI / いっせい
Рет қаралды 186 МЛН
I’m just a kid 🥹🥰 LeoNata family #shorts
00:12
LeoNata Family
Рет қаралды 19 МЛН
Laravel + Livewire todo app (and so much more)
16:41
Aaron Francis
Рет қаралды 34 М.
My first open source package, Livewire Filemanager with Yves Engetschwiler
19:54
Laravel Switzerland Meetup
Рет қаралды 122
9 Tips for Shorter Laravel Code
10:16
Laravel Daily
Рет қаралды 61 М.
Laravel: Avoid Try-Catch In Every Method (What To Do Instead)
4:45
Laravel Daily
Рет қаралды 28 М.
Top 5 Laravel "Bad Practices" (My Opinion)
10:32
Laravel Daily
Рет қаралды 18 М.
File Upload in Laravel: Main Things You Need To Know
13:58
Laravel Daily
Рет қаралды 20 М.
3 "Hidden" Laravel Features To Be Careful About
6:34
Laravel Daily
Рет қаралды 7 М.
10 Tailwind Classes I Wish I Knew Earlier
13:31
Web Dev Simplified
Рет қаралды 166 М.
How did we do? 👀😬😅 @RaenaTripleCharm 🍍 | Gabriella Triple Charm #shorts
0:19
Странные штыри с кольцами из сарая
0:31
А на даче жизнь иначе!
Рет қаралды 1,7 МЛН
Skateboarding Down the Steps
0:11
Ryan's World
Рет қаралды 7 МЛН
I Built 100 Houses And Gave Them Away!
9:36
MrBeast
Рет қаралды 54 МЛН
Cat Tommy lost his love…💔 #cat #cats
0:27
Prince Tom
Рет қаралды 2,1 МЛН
Странные штыри с кольцами из сарая
0:31
А на даче жизнь иначе!
Рет қаралды 1,7 МЛН