PHP code example of surda / pdf
1. Go to this page and download the library: Download surda/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/ */
surda / pdf example snippets
/** @var Surda\Pdf\IPdfBuilderFactory @inject */
public $pdfBuilderFactory;
// Builder
$builder = $this->pdfBuilderFactory->create();
// Template
$builder->setTemplateFile(__DIR__ . '/path/to/template.latte');
$builder->setParameters([
'foo' => 'World!',
]);
// Get Mpdf
$mpdf = $builder->getMpdf();
$this->sendResponse(new PdfResponse($mpdf->Output('file.pdf', \MPdf\Output\Destination::DOWNLOAD)));