codedge / laravel-fpdf
Laravel package to include Fpdf. It ships with Fpdf 1.86.
Fund package maintenance!
codedge
Installs: 1 293 962
Dependents: 4
Suggesters: 0
Security: 0
Stars: 272
Watchers: 8
Forks: 76
Open Issues: 6
Requires
- php: ^8.1
- illuminate/support: ^9.0 || ^10.0 || ^11.0
Requires (Dev)
- ergebnis/composer-normalize: ^2.39
- orchestra/testbench: ^7.35.0 || ^8.0 || ^9.0
- phpunit/phpunit: ^9.6.0 || ^10.5
- dev-master
- 1.12.1
- 1.12.0
- 1.11.0
- 1.10.0
- 1.9.1
- 1.9.0
- 1.8.1
- 1.8.0
- 1.7.2
- 1.7.1
- 1.7.0
- 1.6.2
- 1.6.1
- 1.6.0
- 1.5.2
- 1.5.1
- 1.5
- 1.4
- 1.3.1
- 1.3.0
- 1.2.3
- 1.2.2
- 1.2.1
- 1.2
- 1.1
- 1.0
- dev-dependabot/github_actions/shivammathur/setup-php-2.30.5
- dev-dependabot/composer/ergebnis/composer-normalize-tw-2.42
- dev-dependabot/composer/orchestra/testbench-tw-8.19.0
- dev-dependabot/composer/phpunit/phpunit-tw-10.5.5
- dev-dependabot/composer/orchestra/testbench-tw-8.0.8
This package is auto-updated.
Last update: 2024-12-03 10:14:48 UTC
README
Using FPDF made easy with Laravel. See FPDF homepage for more information about the usage.
Installation using Composer
composer require codedge/laravel-fpdf
Configuration
Run
php artisan vendor:publish --provider="Codedge\Fpdf\FpdfServiceProvider" --tag=config
to publish the configuration file to config/fpdf.php
.
Usage
// app/Http/routes.php | app/routes/web.php Route::get('/', function (Codedge\Fpdf\Fpdf\Fpdf $fpdf) { $fpdf->AddPage(); $fpdf->SetFont('Courier', 'B', 18); $fpdf->Cell(50, 25, 'Hello World!'); $fpdf->Output(); exit; });
Defining fonts
FPDF comes with a set of fonts already defined and stored in the src/Fpdf/font
directory.
If you want to add your own font, please have a look at the Adding new fonts and encodings tutorial.
You can change the font path, by using the FPDF_FONTPATH
environment variable.
Use in Laravel Vapor
If you want to use Laravel Vapor to host your application, a special header needs to be attached to each response that FPDF returns to your browser. To enable the use of this header, add the following environment variable to the Vapor environment file:
FPDF_VAPOR_HEADERS=true