Permalink
Find file Copy path
2808c80 Jul 31, 2018
1 contributor

Users who have contributed to this file

33 lines (28 sloc) 829 Bytes
<?php
/**
* Html2Pdf Library - example
*
* HTML => PDF converter
* distributed under the OSL-3.0 License
*
* @package Html2pdf
* @author Laurent MINGUET <webmaster@html2pdf.fr>
* @copyright 2017 Laurent MINGUET
*/
require_once dirname(__FILE__).'/../vendor/autoload.php';
use Spipu\Html2Pdf\Html2Pdf;
use Spipu\Html2Pdf\Exception\Html2PdfException;
use Spipu\Html2Pdf\Exception\ExceptionFormatter;
try {
ob_start();
include dirname(__FILE__).'/res/example11.php';
$content = ob_get_clean();
$html2pdf = new Html2Pdf('P', 'A4', 'fr');
$html2pdf->setTestTdInOnePage(false);
$html2pdf->writeHTML($content);
$html2pdf->output('example11.pdf');
} catch (Html2PdfException $e) {
$html2pdf->clean();
$formatter = new ExceptionFormatter($e);
echo $formatter->getHtmlMessage();
}