All Projects → elibyy → Tcpdf Laravel

elibyy / Tcpdf Laravel

Licence: mit
TCPDF helper for laravel

Projects that are alternatives of or similar to Tcpdf Laravel

Invoices
Generate PDF invoices for your customers in laravel
Stars: ✭ 298 (+73.26%)
Mutual labels:  laravel, pdf
Laravel Book
Up to date Epub, Mobi and PDF versions from the official Laravel Docs
Stars: ✭ 221 (+28.49%)
Mutual labels:  laravel, pdf
Shaark
Self-hosted platform to keep and share your content: web links, posts, passwords and pictures.
Stars: ✭ 258 (+50%)
Mutual labels:  laravel, pdf
Laravel Report Generator
Rapidly Generate Simple Pdf, CSV, & Excel Report Package on Laravel
Stars: ✭ 380 (+120.93%)
Mutual labels:  laravel, pdf
Laravel Dompdf
A DOMPDF Wrapper for Laravel
Stars: ✭ 4,978 (+2794.19%)
Mutual labels:  laravel, pdf
Invoice As A Service
💰 Simple invoicing service (REST API): from JSON to PDF
Stars: ✭ 106 (-38.37%)
Mutual labels:  laravel, pdf
Laravel Pdf
A Simple package for easily generating PDF documents from HTML. This package is specially for laravel but you can use this without laravel.
Stars: ✭ 79 (-54.07%)
Mutual labels:  laravel, pdf
Report
Report management package in PHP that aims to help you export information in a variety of formats
Stars: ✭ 125 (-27.33%)
Mutual labels:  laravel, pdf
Laravel Selfupdater
This package provides some basic methods to implement a self updating functionality for your Laravel application. Already bundled are some methods to provide a self-update mechanism via Github or some private repository via http.
Stars: ✭ 170 (-1.16%)
Mutual labels:  laravel
Lapse
Laravel Self Hosted Tiny Error Tracking System With Notifications
Stars: ✭ 172 (+0%)
Mutual labels:  laravel
Viewprinter
Live preview, edit and print functionality for View hierarchies. Supports PDF, PNG, JPEG.
Stars: ✭ 170 (-1.16%)
Mutual labels:  pdf
Travis Ci Latex Pdf
Travis CI and deployment service to build PDF from LaTeX document.
Stars: ✭ 170 (-1.16%)
Mutual labels:  pdf
Dv Php Core
Devless is a ready-made back-end for development of web or mobile applications. It is fully open source under the permissive Apache v2 license. This means that you can develop your front end without worrying about neither back-end code or the business risk of a proprietary backend-as-a-service.
Stars: ✭ 171 (-0.58%)
Mutual labels:  laravel
Neotex
latex live preview - plugin for neovim and vim 8
Stars: ✭ 170 (-1.16%)
Mutual labels:  pdf
Laravel Addresses
Rinvex Addressable is a polymorphic Laravel package, for addressbook management. You can add addresses to any eloquent model with ease.
Stars: ✭ 170 (-1.16%)
Mutual labels:  laravel
Laravel Nova Nested Form
This package allows you to include your nested relationships' forms into a parent form.
Stars: ✭ 169 (-1.74%)
Mutual labels:  laravel
Laravel Translatable
[Deprecated] A Laravel package for multilingual models
Stars: ✭ 1,974 (+1047.67%)
Mutual labels:  laravel
Novel
基于 Laravel 5.2 的小说网站
Stars: ✭ 172 (+0%)
Mutual labels:  laravel
Ddd Laravel Sample
A Laravel DDD sample application using CQRS and persisting entities serialized without ORM
Stars: ✭ 172 (+0%)
Mutual labels:  laravel
Multi Domain Laravel
An example of multi-domain/subdomain app in Laravel.
Stars: ✭ 171 (-0.58%)
Mutual labels:  laravel

Laravel 6-7-8 TCPDF

Latest Stable Version Total Downloads Latest Unstable Version License

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

TCPDF is not really supported in PHP 7 but there's a plan for supporting it, check this out.

Installation

The Laravel TCPDF service provider can be installed via composer 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": "^8.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

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

Header/Footer 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){})

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].