PHP code example of takeoo / zend-pdf

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

    

takeoo / zend-pdf example snippets


  $pdfCreator = $serviceManager->get('PdfCreator');
  

        $pdfCreator->setLayoutTemplate('layout/pdf-template');
       

       $pdfCreator->createHtml('path/to/view', ['variableName' => $variableValue]);
       

       $pdfCreator->createHtmlFromViewModel($viewModel);
       

            $pdfCreator->output();
            

           $pdfCreator->writePdf();
           

       $pdfCreator->getFilePath();
       

        $pdfCreator->setPdfFileName('path/to/desired/folder/nameofyourfile.pdf');
        

   $pdfCreator->setLayoutTemplate('layout/pdf-layout')
     ->createHtml('view', ['variable1' => $variable1Value])
     ->setPdfFileName('./../file.pdf')
     ->setHasXvfb(false)
     ->output();
   

$pdfCreator->setHasXvfb(false);