New Spatie PDF Package: Use Tailwind Styles in PDF

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello guys for quite a long time creating PDFs in larl was really Limited in terms of styling and spotty have released a new package called laravel PDF to solve that under the hood it uses their own browser shot package which under the hood uses chromium engine and node Library called Puppeteer which all together combined allows you to use something like Tailwind CSS to create your PDF so this is the official tweet read by FR wonderer herton and you can see some of the syntax here on the screen or you can browse through the official article which was released on January 2nd so this is the syntax you create PDF file from laravel blade and then you can save it or download it however you want and the main thing about this package is not the syntax of PDF view but the blade part of it so there's another article released a few weeks later specifically about invoices and here's the HTML or blade file which uses Tailwind from CDN with divs font Bal borders text to Excel and other stuff for the layout and the result is this PDF this is not in a browser this is a PDF file and another example of using that PDF package comes from Joe Talon bom who created his own CV as a PDF or exported the existing blade file into this so if you go to that URL it would actually take some time to load like 5 to 10 seconds but this would be a PDF result PDF of CV like this and I also tested it myself with a simple Tailwind I asked Chad GPT to build a simple page for me with tailwind and this is the result of resume web developer resume nothing really fancy but Tailwind Styles included background paddings bold list and others and I've pasted it into a blade file pdf. blade in my project so nothing really fancy no really variables or anything and in the routes I've created two routes one to show how it looks in the browser as a blade and then how it is saved as a PDF and let's compare those by the way to make the package work you need to satisfy the requirements of browser shot package which is here which is npm install Puppeteer without that Puppeteer the package wouldn't work so this is the result of that simple template in a browser so as you can see colors borders some paddings and stuff like that and if we launch the same PDF route it takes roughly 5 seconds or so yep success and then in my PHP storm I have this PDF file exported and if we open that this is the result the same PDF almost identical as it was in the browser with colors paddings borders and other stuff so pretty impressive so all in all if you want to generate PDFs with styling the new package of spyy PDF should be a good choice try it out or if you have tried it out share in the comments below your experience tips or any other tools for PDFs in larl subscribe to the channel to get more videos on larl and related topics and packages and see you guys other videos
Info
Channel: Laravel Daily
Views: 11,603
Rating: undefined out of 5
Keywords:
Id: QjoIpJj8qxU
Channel Id: undefined
Length: 3min 18sec (198 seconds)
Published: Thu Jan 18 2024
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.