PHPackages                             ptastrus/tcpdf-laravel - 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. ptastrus/tcpdf-laravel

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

ptastrus/tcpdf-laravel
======================

tcpdf support for Laravel 6, 7, 8, 9, 10, 11

11.1.2(1y ago)012MITPHP

Since Feb 10Pushed 1y agoCompare

[ Source](https://github.com/ptastrus/tcpdf-laravel)[ Packagist](https://packagist.org/packages/ptastrus/tcpdf-laravel)[ RSS](/packages/ptastrus-tcpdf-laravel/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (2)Versions (92)Used By (0)

Laravel 6-7-8-9-10-11 TCPDF
===========================

[](#laravel-6-7-8-9-10-11-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](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)

```
composer require elibyy/tcpdf-laravel

```

or

Laravel 5.5+ will use the auto-discovery function.

```
{
    "require": {
        "elibyy/tcpdf-laravel": "^9.0"
    }
}
```

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 --provider="Elibyy\TCPDF\ServiceProvider"

```

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

37

—

LowBetter than 83% of packages

Maintenance39

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity79

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

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.

###  Release Activity

Cadence

Every ~36 days

Recently: every ~73 days

Total

91

Last Release

516d ago

Major Versions

6.0.4 → 7.0.02020-03-04

7.0.0 → 8.0.02020-09-09

8.1.2 → 9.0.02022-02-06

9.3.0 → 10.0.02023-02-08

10.0.3 → 11.0.02024-02-21

### Community

Maintainers

![](https://www.gravatar.com/avatar/40a4c3e1c6bdc3ddaac598f54b843d9573cf25668f2d562b6342925ca68e9d73?d=identicon)[tesmojones](/maintainers/tesmojones)

---

Top Contributors

[![it-can](https://avatars.githubusercontent.com/u/644288?v=4)](https://github.com/it-can "it-can (38 commits)")[![elibyy](https://avatars.githubusercontent.com/u/836551?v=4)](https://github.com/elibyy "elibyy (34 commits)")[![tesmojones](https://avatars.githubusercontent.com/u/696439?v=4)](https://github.com/tesmojones "tesmojones (6 commits)")[![honginho](https://avatars.githubusercontent.com/u/32126185?v=4)](https://github.com/honginho "honginho (2 commits)")[![sebaiturravaldes](https://avatars.githubusercontent.com/u/11622941?v=4)](https://github.com/sebaiturravaldes "sebaiturravaldes (2 commits)")[![ahmeti](https://avatars.githubusercontent.com/u/5817450?v=4)](https://github.com/ahmeti "ahmeti (1 commits)")[![laravel-shift](https://avatars.githubusercontent.com/u/15991828?v=4)](https://github.com/laravel-shift "laravel-shift (1 commits)")[![luukverhoeven](https://avatars.githubusercontent.com/u/995760?v=4)](https://github.com/luukverhoeven "luukverhoeven (1 commits)")[![marufmax](https://avatars.githubusercontent.com/u/7222229?v=4)](https://github.com/marufmax "marufmax (1 commits)")[![StelianAndrei](https://avatars.githubusercontent.com/u/1508947?v=4)](https://github.com/StelianAndrei "StelianAndrei (1 commits)")[![fredmarmillod](https://avatars.githubusercontent.com/u/9134609?v=4)](https://github.com/fredmarmillod "fredmarmillod (1 commits)")[![acirinelli](https://avatars.githubusercontent.com/u/3673934?v=4)](https://github.com/acirinelli "acirinelli (1 commits)")[![gabrielmoura](https://avatars.githubusercontent.com/u/3229287?v=4)](https://github.com/gabrielmoura "gabrielmoura (1 commits)")

---

Tags

laravelpdfTCPDF

### Embed Badge

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

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

###  Alternatives

[barryvdh/laravel-dompdf

A DOMPDF Wrapper for Laravel

7.3k87.6M278](/packages/barryvdh-laravel-dompdf)[barryvdh/laravel-snappy

Snappy PDF/Image for Laravel

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

tcpdf support for Laravel 6, 7, 8, 9, 10, 11

3542.7M5](/packages/elibyy-tcpdf-laravel)[maxxscho/laravel-tcpdf

A simple Laravel 4 service provider with some basic configuration for including the TCPDF library

8725.7k](/packages/maxxscho-laravel-tcpdf)[tarfin-labs/easy-pdf

Makes pdf processing easy.

1718.3k](/packages/tarfin-labs-easy-pdf)[lucasromanojf/laravel5-pdf

Provides the HTML2PDF functionality using the wkhtmltopdf library (Laravel 5)

1271.8k](/packages/lucasromanojf-laravel5-pdf)

PHPackages © 2026

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