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

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

steven-starz/tcpdf-laravel
==========================

tcpdf support for Laravel 6, 7, 8, 9

1.0.0(2y ago)03MITPHP

Since Feb 21Pushed 2y agoCompare

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

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

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

[](#laravel-6-7-8-9-10-tcpdf)

[![Latest Stable Version](https://camo.githubusercontent.com/7a5647c9eb50f2d15663524459ae9c7f4379fd7ed63c852049a8d3358cf80ca5/68747470733a2f2f706f7365722e707567782e6f72672f53746576656e537461727a2f74637064662d6c61726176656c2f762f737461626c65)](https://packagist.org/packages/StevenStarz/tcpdf-laravel) [![Total Downloads](https://camo.githubusercontent.com/c2bea39422d04754944f804f164ee8f8478066c74b62279c176c5417d6adb020/68747470733a2f2f706f7365722e707567782e6f72672f53746576656e537461727a2f74637064662d6c61726176656c2f646f776e6c6f616473)](https://packagist.org/packages/StevenStarz/tcpdf-laravel) [![Latest Unstable Version](https://camo.githubusercontent.com/ef98824680d5722c880bc8f24e4908643e6fd5cb07ae2f15b800c6ddd611d1e8/68747470733a2f2f706f7365722e707567782e6f72672f53746576656e537461727a2f74637064662d6c61726176656c2f762f756e737461626c65)](https://packagist.org/packages/StevenStarz/tcpdf-laravel) [![License](https://camo.githubusercontent.com/e1c02a4c06c98414450480a5008fb1bc3b84e6c14f12afa838fd29037ce0d100/68747470733a2f2f706f7365722e707567782e6f72672f53746576656e537461727a2f74637064662d6c61726176656c2f6c6963656e7365)](https://packagist.org/packages/StevenStarz/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 `StevenStarz/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 StevenStarz/tcpdf-laravel

```

or

Laravel 5.5+ will use the auto-discovery function.

```
{
    "require": {
        "StevenStarz/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' => [
    //...
    StevenStarz\TCPDF\ServiceProvider::class,
]

//...

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

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

for lumen you should add the following lines:

```
$app->register(StevenStarz\TCPDF\ServiceProvider::class);
class_alias(StevenStarz\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="StevenStarz\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

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity3

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 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

Unknown

Total

1

Last Release

811d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/11be8b8bc82a11ca26c7fe264ebb30ec5e71d7152220c3a79a35863e363b1ff4?d=identicon)[StevenStarz](/maintainers/StevenStarz)

---

Top Contributors

[![elibyy](https://avatars.githubusercontent.com/u/836551?v=4)](https://github.com/elibyy "elibyy (34 commits)")[![it-can](https://avatars.githubusercontent.com/u/644288?v=4)](https://github.com/it-can "it-can (32 commits)")[![StevenStarz](https://avatars.githubusercontent.com/u/22284886?v=4)](https://github.com/StevenStarz "StevenStarz (3 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)")[![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)")[![laravel-shift](https://avatars.githubusercontent.com/u/15991828?v=4)](https://github.com/laravel-shift "laravel-shift (1 commits)")[![ahmeti](https://avatars.githubusercontent.com/u/5817450?v=4)](https://github.com/ahmeti "ahmeti (1 commits)")[![gabrielmoura](https://avatars.githubusercontent.com/u/3229287?v=4)](https://github.com/gabrielmoura "gabrielmoura (1 commits)")[![acirinelli](https://avatars.githubusercontent.com/u/3673934?v=4)](https://github.com/acirinelli "acirinelli (1 commits)")[![luukverhoeven](https://avatars.githubusercontent.com/u/995760?v=4)](https://github.com/luukverhoeven "luukverhoeven (1 commits)")

---

Tags

laravelpdfTCPDF

### Embed Badge

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

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

###  Alternatives

[barryvdh/laravel-dompdf

A DOMPDF Wrapper for Laravel

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

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

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

Snappy PDF/Image for Laravel

2.8k24.8M48](/packages/barryvdh-laravel-snappy)[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)
