Jump24 - Laravel Developers that Click into Place. Never outsourced. Never offshored. Always exceptional.

Laravel Fpdf

codedge/laravel-fpdf image

Laravel Fpdf stats

Downloads
845.4K
Stars
235
Open Issues
6
Forks
72

View on GitHub →

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

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

The Artisan Files: Jesse O’Brien image

The Artisan Files: Jesse O’Brien

Read article
Curotec logo

Curotec

World class Laravel experts with GenAI dev skills. LATAM-based, embedded engineers that ship fast, communicate clearly, and elevate your product. No bloat, no BS.

Curotec
Celebian logo

Celebian

Celebian is a social media marketing agency specializing in helping their clients go viral on TikTok. Whether you're looking to reach a bigger audience or gain more Tiktok followers, likes, and views, they've got you covered.

Celebian
Kirschbaum logo

Kirschbaum

Providing innovation and stability to ensure your web application succeeds.

Kirschbaum
CodeKudu logo

CodeKudu

Stand-ups, Retrospectives, and 360° Feedback for the entire team. 50% off with code LARAVELNEWS.

CodeKudu
Typesense Search logo

Typesense Search

Typesense is an open source, blazing-fast search engine, optimized for helping you build delightful search experiences for your sites and apps. Natively integrated with Laravel Scout.

Typesense Search
MongoDB logo

MongoDB

Enhance your PHP applications with the powerful integration of MongoDB and Laravel, empowering developers to build applications with ease and efficiency. Support transactional, search, analytics and mobile use cases while using the familiar Eloquent APIs. Discover how MongoDB's flexible, modern database can transform your Laravel applications.

MongoDB