Laravel package to include Fpdf. It ships with Fpdf 1.86.

codedge/laravel-fpdf image

codedge/laravel-fpdf stats

Downloads
845.4K
Stars
235
Open Issues
6
Forks
72

View on GitHub →

Codedge Laravel-fpdf Readme


Laravel package for Fpdf

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
codedge photo

🤖 Engineering @MZero-Labs • Building @hedge10 🖥️

Cube

Laravel Newsletter

Join 40k+ other developers and never miss out on new tips, tutorials, and more.


Codedge Laravel Fpdf Related Articles

Kirschbaum logo

Kirschbaum

Providing innovation and stability to ensure your web application succeeds.

Kirschbaum
SaaSykit: Laravel SaaS Starter Kit logo

SaaSykit: Laravel SaaS Starter Kit

SaaSykit is a Laravel SaaS Starter Kit that comes with all features required to run a modern SaaS. Payments, Beautiful Checkout, Admin Panel, User dashboard, Auth, Ready Components, Stats, Blog, Docs and more.

SaaSykit: Laravel SaaS Starter Kit
Laravel Forge logo

Laravel Forge

Easily create and manage your servers and deploy your Laravel applications in seconds.

Laravel Forge
Rector logo

Rector

Your partner for seamless Laravel upgrades, cutting costs, and accelerating innovation for successful companies

Rector
Shift logo

Shift

Running an old Laravel version? Instant, automated Laravel upgrades and code modernization to keep your applications fresh.

Shift
Tinkerwell logo

Tinkerwell

The must-have code runner for Laravel developers. Tinker with AI, autocompletion and instant feedback on local and production environments.

Tinkerwell