PHP code example of villca / tcpdf-laravel

1. Go to this page and download the library: Download villca/tcpdf-laravel library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

villca / tcpdf-laravel example snippets


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

//...

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



namespace App\Http\Controllers;

use PDF;

class ReportesController extends Controller
{
    public function index()
    {
              PDF::SetTitle('Hola Mundo');
              PDF::AddPage();
              PDF::Write(0, 'Bienvenido a TCPDF-Laravel');
              PDF::Output('hola_mundo.pdf');
    }
}
json
  php artisan vendor:publish