2017 © Pedro Peláez
 

library laravel-tcpdf

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

image

maxxscho/laravel-tcpdf

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

  • Thursday, September 15, 2016
  • by maxxscho
  • Repository
  • 5 Watchers
  • 91 Stars
  • 19,285 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 25 Forks
  • 1 Open issues
  • 9 Versions
  • 1 % Grown

The README.md

NOT MAINTAINED ANYMORE!!, (*1)

Laravel TCPDF

Build Status, (*2)

A simple Laravel 4 service provider with some basic configuration for including the TCPDF library, (*3)

Installation

The Laravel TCPDF service provider can be installed via composer by requiring the maxxscho/laravel-tcpdf 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), (*4)

{
    "require": {
        "maxxscho/laravel-tcpdf": "0.*"
    }
}

Next, add the service provider to app/config/app.php., (*5)

'providers' => [
    //..
    'Maxxscho\LaravelTcpdf\LaravelTcpdfServiceProvider',
]

That's it! You're good to go., (*6)

Here is a little example:, (*7)

PDF::SetTitle('Hello World');

PDF::AddPage();

PDF::Write(0, 'Hello World');

PDF::Output('hello_world.pdf');

For a list of all available function take a look at the TCPDF Documentation, (*8)

Configuration

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

php artisan config:publish maxxscho/laravel-tcpdf

Now access app/config/packages/maxxscho/laravel-tcpdf/config.phpto customize., (*10)

Assets

There is a 'blank' image in the assets folder of the package, which is in certain circumstances needed by TCPDF. Publish the assets, like so:, (*11)

php artisan asset:publish maxxscho/laravel-tcpdf

Extend/Overwrite

Extending or overwriting Laravel TCPDF is easy. Simply extend \Maxxscho\LaravelTcpdf\LaravelTcpdf with your own class., (*12)

Custom Fonts

To add custom fonts set the fonts_directory in the config, relative to the public path. For example 'fonts/'., (*13)

To use a custom font you have to convert a font for TCPDF. Copy your custom font(s) to your fonts path, in our case public/fonts/. In your terminal do this:, (*14)

vendor/maxxscho/laravel-tcpdf/vendor/tecnick.com/tcpdf/tools/tcpdf_addfont.php -i public/fonts/yourfont.ttf -o public/fonts

This uses a little tool provided by TCPDF to convert fonts for TCPDF. The -i flag is for the input fonts (comma-separated list) and the -o flag is for the output directory. Read here all about TCPDF fonts and how to convert them the new way., (*15)

Custom Header

"PDF::setHtmlHeader($custom_header); PDF::Header();", (*16)

The Versions

15/09 2016

dev-master

9999999-dev

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

  Sources   Download

MIT

The Requires

 

by Markus Schober

laravel pdf tcpdf

08/12 2014

0.2.6

0.2.6.0

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

  Sources   Download

MIT

The Requires

 

by Markus Schober

laravel pdf tcpdf

11/07 2014

0.2.5

0.2.5.0

  Sources   Download

The Requires

 

by Markus Schober

10/07 2014

0.2.4

0.2.4.0

  Sources   Download

The Requires

 

by Markus Schober

30/05 2014

0.2.3

0.2.3.0

  Sources   Download

The Requires

 

by Markus Schober

16/04 2014

0.2.2

0.2.2.0

  Sources   Download

The Requires

 

by Markus Schober

12/02 2014

0.2.1

0.2.1.0

  Sources   Download

The Requires

 

by Markus Schober

28/12 2013

0.2.0

0.2.0.0

  Sources   Download

The Requires

 

by Markus Schober

16/12 2013

0.1.0

0.1.0.0

  Sources   Download

The Requires

 

by Markus Schober