mycools/laravel-fpdf

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

Fund package maintenance!
mycools

1.8.0 2021-09-28 07:14 UTC

This package is auto-updated.

Last update: 2024-04-28 12:39:42 UTC


README

Original Package see : https://github.com/mycools/laravel-fpdf

Using FPDF made easy with Laravel (V 1.8.4). See FPDF homepage for more information about the usage.

Installation using Composer

$ composer require mycools/laravel-fpdf

Configuration

Run
php artisan vendor:publish --provider="Mycools\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 (Mycools\Fpdf\Fpdf\Fpdf $fpdf) {

    $fpdf->AddPage();
    $fpdf->SetFont('Courier', 'B', 18);
    $fpdf->Cell(50, 25, 'Hello World!');
    $fpdf->Output();

});

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