PHP code example of famelo / pdf

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

    

famelo / pdf example snippets


$document = new \Famelo\PDF\Document('My.Package:SomeDocument');
$document->assign('someVariable', 'foobar');

// Trigger a Download and exit
$document->download('SomeDocument ' . date('d.m.Y') . '.pdf');

// Show the document inline and exit
$document->send();

// Save the document to a local file
$document->save('/Some/Path/SomeDocument ' . date('d.m.Y') . '.pdf');

// set format to A5 Portrait
$document = new \Famelo\PDF\Document('My.Package:SomeDocument', 'A5');

// set format to an A4 Landscape
$document->setFormat('A4-L');

// set format to 100mm x 200mm
$document->setFormat(array(100, 200));