akibo liked this thread
Hello Zahidzee,
A view can be cast to a string, on that way you get the html. The HTML can used in a html to pdf class.
For the dompdf way, did you get a result for a small text? With that you can test if it is a problem with the content of your view or with dompdf in general.
What do you use for pdf snappy? The error you mention sounds like a missing configuration.
If you can share some code there is a bigger change that someone can help you.
Run the under-mentioned command to install DomPDF in Laravel 8.
composer require barryvdh/laravel-dompdf
<?php namespace App\Http\Controllers; use Illuminate\Http\Request; use App\Models\Employee; use PDF; class EmployeeController extends Controller { // Display user data in view public function showEmployees(){ $employee = Employee::all(); return view('index', compact('employee')); } // Generate PDF public function createPDF() { // retreive all records from db $data = Employee::all(); // share data to view view()->share('employee',$data); $pdf = PDF::loadView('pdf_view', $data); // download PDF file with download method return $pdf->download('pdf_file.pdf'); } } Hope you helpful ..Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community