We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to use in a controller?
Laravel 5.6
The text was updated successfully, but these errors were encountered:
For example POST Method in your controller, Laravel auto resolver create instance for you. Also u can statically call class
public function store(Request $request, Codedge\Fpdf\Fpdf\Fpdf $fpdf) { $fpdf->AddPage(); $fpdf->SetFont('Courier', 'B', 18); $fpdf->Cell(50, 25, 'Hello World!'); $fpdf->Output(); });
Sorry, something went wrong.
This code works for my using Laravel 5.6 and codedge/laravel-fpdf 1.2
public function print($id): BinaryFileResponse { $pathFile = storage_path(). '/recipe.pdf'; Fpdf::AddPage(); Fpdf::SetFont('Courier', 'B', 18); Fpdf::Cell(50, 25, 'Hello World!'); Fpdf::Output('F', $pathFile); $headers = ['Content-Type' => 'application/pdf']; return response()->file($pathFile, $headers); }
Do not forget to import FPDF facade.
use Codedge\Fpdf\Facades\Fpdf;
No branches or pull requests
How to use in a controller?
Laravel 5.6
The text was updated successfully, but these errors were encountered: