Laravel pdf generator package

Опубликовано: 20 Октябрь 2024
на канале: Code Combination
113
1

Hello,
In this video we will make pdf of laravel view files in our scenario we will download results of students as pdf
--------------------------------------------------------------------------------------------------
PDF Package Link: https://github.com/barryvdh/laravel-d...
----------------------------------------------------------------------------------------------------


Steps:

1)Create a results table and its seeder
2)After migration and seeding we install the https://github.com/barryvdh/laravel-d...
package which will be used to convert view file to pdf or can be used to convert HTML to PDF.
3) Inside view folder we made results folder in which we created two files
index.blade.php (which we will use for our website view)
resultsonly.blade.php ( which we will use to as pdf only )
we have created them separately just for ease of styling you can create files as you like
4) After fetching results and loading them on index file from controller we make download button and pass id of that student to that route
5) after hitting route we only load our resultsonly file as we want to just get table of student
then we use pdf loadview functions and download the pdf
---------------------------------------------------------------------------------------
Note: The isRemoteEnabled is set to true in setOptions parameter in our downloadPdf function which allows us to include images in our pdf file.