PHPackages                             m3skalina/tcpdf-laravel-5 - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [PDF &amp; Document Generation](/categories/documents)
4. /
5. m3skalina/tcpdf-laravel-5

ActiveLibrary[PDF &amp; Document Generation](/categories/documents)

m3skalina/tcpdf-laravel-5
=========================

tcpdf support for laravel 5

015PHP

Since Jan 31Pushed 5y ago1 watchersCompare

[ Source](https://github.com/m3skalina/tcpdf-laravel-5)[ Packagist](https://packagist.org/packages/m3skalina/tcpdf-laravel-5)[ RSS](/packages/m3skalina-tcpdf-laravel-5/feed)WikiDiscussions main Synced yesterday

READMEChangelogDependenciesVersions (1)Used By (0)

Laravel 5.8 TCPDF
=================

[](#laravel-58-tcpdf)

[![Latest Stable Version](https://camo.githubusercontent.com/fc462d69c7fa88e7dddd5ad59c94a3dc98bcb7ace0bb7e60f27506074934bf55/68747470733a2f2f706f7365722e707567782e6f72672f656c696279792f74637064662d6c61726176656c2f762f737461626c65)](https://packagist.org/packages/elibyy/tcpdf-laravel) [![Total Downloads](https://camo.githubusercontent.com/12c54a16065e65f90a7f3e8d9aab3dfe923b2b6e39adedbe6fdf6e3afd3385ff/68747470733a2f2f706f7365722e707567782e6f72672f656c696279792f74637064662d6c61726176656c2f646f776e6c6f616473)](https://packagist.org/packages/elibyy/tcpdf-laravel) [![Latest Unstable Version](https://camo.githubusercontent.com/68e7fc05be5794d0c6e859cfae7433dad3d7c72133fbf66617682e7f6e02496a/68747470733a2f2f706f7365722e707567782e6f72672f656c696279792f74637064662d6c61726176656c2f762f756e737461626c65)](https://packagist.org/packages/elibyy/tcpdf-laravel) [![License](https://camo.githubusercontent.com/81042a95e7d62f3f394f567a5d8d9b24da6953167162a13f8ef8f0b82214763a/68747470733a2f2f706f7365722e707567782e6f72672f656c696279792f74637064662d6c61726176656c2f6c6963656e7365)](https://packagist.org/packages/elibyy/tcpdf-laravel)

A simple [Laravel 5](http://www.laravel.com) service provider with some basic configuration for including the [TCPDF library](http://www.tcpdf.org/)

#### TCPDF is not really supported in PHP 7 but there's a plan for supporting it, check [this](https://github.com/tecnickcom/tc-lib-pdf) out.

[](#tcpdf-is-not-really-supported-in-php-7-but-theres-a-plan-for-supporting-it-check-this-out)

Installation
------------

[](#installation)

The Laravel TCPDF service provider can be installed via [composer](http://getcomposer.org) by requiring the `elibyy/tcpdf-laravel` package in your project's `composer.json`. (The installation may take a while, because the package requires TCPDF. Sadly its .git folder is very heavy)

Laravel 5.5+ will use the auto-discovery function.

```
{
    "require": {
        "elibyy/tcpdf-laravel": "5.8.*"
    }
}
```

If you don't use auto-discovery you will need to include the service provider / facade in `config/app.php`.

```
'providers' => [
    //...
    Elibyy\TCPDF\ServiceProvider::class,
]

//...

'aliases' => [
    //...
    'PDF' => Elibyy\TCPDF\Facades\TCPDF::class
]
```

(Please note: TCPDF cannot be used as an alias)

for lumen you should add the following lines:

```
$app->register(Elibyy\TCPDF\ServiceProvider::class);
class_alias(Elibyy\TCPDF\Facades\TCPDF::class, 'PDF');
```

That's it! You're good to go.

Here is a little example:

```
use PDF; // at the top of the file

  PDF::SetTitle('Hello World');
  PDF::AddPage();
  PDF::Write(0, 'Hello World');
  PDF::Output('hello_world.pdf');
```

another example for generating multiple PDF's

```
use PDF; // at the top of the file

  for ($i = 0; $i < 5; $i++) {
    PDF::SetTitle('Hello World'.$i);
    PDF::AddPage();
    PDF::Write(0, 'Hello World'.$i);
    PDF::Output(public_path('hello_world' . $i . '.pdf'), 'F');
    PDF::reset();
  }
```

For a list of all available function take a look at the [TCPDF Documentation](http://www.tcpdf.org/doc/code/classTCPDF.html)

Configuration
-------------

[](#configuration)

Laravel-TCPDF comes with some basic configuration. If you want to override the defaults, you can publish the config, like so:

```
php artisan vendor:publish

```

Now access `config/tcpdf.php` to customize.

- use\_original\_header is to used the original `Header()` from TCPDF.
    - Please note that `PDF::setHeaderCallback(function($pdf){})` overrides this settings.
- use\_original\_footer is to used the original `Footer()` from TCPDF.
    - Please note that `PDF::setFooterCallback(function($pdf){})` overrides this settings.
- use\_fpdi is so that our internal helper will extend `TcpdfFpdi` instead of `TCPDF`.
    - Please note fpdi is not a dependency in my project so you will have to follow their install instructions [here](https://github.com/Setasign/FPDI)

Header/Footer helpers
---------------------

[](#headerfooter-helpers)

I've got a pull-request asking for this so I've added the feature

now you can use `PDF::setHeaderCallback(function($pdf){})` or `PDF::setFooterCallback(function($pdf){})`

###  Health Score

17

—

LowBetter than 6% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity31

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/80cdf5394a2b8d60f397931a2f80b1665ccdcc88ad62a90f522ffd2bcd3d3564?d=identicon)[m3skalina](/maintainers/m3skalina)

---

Top Contributors

[![m3skalina](https://avatars.githubusercontent.com/u/43817736?v=4)](https://github.com/m3skalina "m3skalina (5 commits)")

### Embed Badge

![Health badge](/badges/m3skalina-tcpdf-laravel-5/health.svg)

```
[![Health](https://phpackages.com/badges/m3skalina-tcpdf-laravel-5/health.svg)](https://phpackages.com/packages/m3skalina-tcpdf-laravel-5)
```

###  Alternatives

[phpoffice/phpspreadsheet

PHPSpreadsheet - Read, Create and Write Spreadsheet documents in PHP - Spreadsheet engine

13.9k293.5M1.3k](/packages/phpoffice-phpspreadsheet)[spatie/browsershot

Convert a webpage to an image or pdf using headless Chrome

5.2k32.1M102](/packages/spatie-browsershot)[smalot/pdfparser

Pdf parser library. Can read and extract information from pdf file.

2.7k34.5M216](/packages/smalot-pdfparser)[barryvdh/laravel-snappy

Snappy PDF/Image for Laravel

2.8k24.8M48](/packages/barryvdh-laravel-snappy)[openspout/openspout

PHP Library to read and write spreadsheet files (CSV, XLSX and ODS), in a fast and scalable way

1.1k57.6M131](/packages/openspout-openspout)[keboola/csv

Keboola CSV reader and writer

1451.8M21](/packages/keboola-csv)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
