How to Download a Pdf File
Hii all, i was trying to download a pdf file that pdf view page having in a blade file..i need to download a column data only..
17 Replies
No sure what's the issue? Use a link to the PDF and it should open/download?
the pdf design i have in a blade file....i used $evaluate to get data...that showing error undifined variable $evaluate
So you aren't asking about "download" but about the generation of a PDF?
$evaluate
is an internal method of Filament. Why are you using this in a Blade to generate a PDF? You should use the record dataokay..Thank you.
i can't pass record data directley to blade file from resource
Action
..is it need to create controller for that..You can get record via Closure
fn ($record) =>
okay
Did you get sorted?
i having ViewField can i download diretly as pdf file through
->action()
Action::make('view_pdf')
->action(function () {
})
Yeah
how...
I did it with an icon column within a table personally, but you can see the principle:
thank you..!
point in my example is the response()->download()
Return a download response
return response()->download(storagePath())
in this, how to give localstorage [download] as a storagePath
..response()->download()
accpets the storage path as an argument, there you should put the path of the file you want to download, see https://laravel.com/docs/10.x/responses#file-downloadsLaravel - The PHP Framework For Web Artisans
Laravel is a PHP web application framework with expressive, elegant syntax. We’ve already laid the foundation — freeing you to create without sweating the small things.
so that would be:
->download(storagePath() . '/pdfs/myfile.pdf')