Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $vendor_file=dirname(__FILE__).'/../vendor/autoload.php';
- require_once $vendor_file;
- use Spipu\Html2Pdf\Html2Pdf;
- use Spipu\Html2Pdf\Exception\Html2PdfException;
- use Spipu\Html2Pdf\Exception\ExceptionFormatter;
- try {
- ob_start();
- include dirname(__FILE__).'/html/hello.html';
- $content = ob_get_clean();
- $html2pdf = new Html2Pdf('P', 'A4', 'fr');
- $html2pdf->setDefaultFont('Arial');
- $html2pdf->writeHTML($content);
- $html2pdf->output('example00.pdf');
- } catch (Html2PdfException $e) {
- $html2pdf->clean();
- $formatter = new ExceptionFormatter($e);
- echo $formatter->getHtmlMessage();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement