PHP code example of ghidev / fpdf

1. Go to this page and download the library: Download ghidev/fpdf 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/ */

    

ghidev / fpdf example snippets


'providers' => array(
	// ...
    
    Ghidev\Fpdf\FpdfServiceProvider::class,
    Ghidev\Fpdf\RotationServiceProvider::class,
    Ghidev\Fpdf\MC_TableServiceProvider::class,
)

'aliases' => array(
	// ...

	'Fpdf'      => Ghidev\Fpdf\Facades\Fpdf::class,
    'Rotation'    => Ghidev\Fpdf\Facades\Rotation::class,
    'MC_Table'  => Ghidev\Fpdf\Facades\MC_Table::class,
)

Route::get('pdf', function(){

    $fpdf = new Ghidev\Fpdf\Fpdf;
    $fpdf->AddPage();
    $fpdf->SetFont('Arial','B',16);
    $fpdf->Cell(40,10,'Hello World!');
    $fpdf->Output();
    exit;

});

Route::get('pdf', function(){

    Fpdf::AddPage();
    Fpdf::SetFont('Arial','B',16);
    Fpdf::Cell(40,10,'Hello World!');
    Fpdf::Output();
    exit;
});