forked from spipu/html2pdf
- Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathexample14.php
More file actions
Latest commit
33 lines (29 loc) · 875 Bytes
/
Copy pathexample14.php
File metadata and controls
33 lines (29 loc) · 875 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<?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_oncedirname(__FILE__).'/../vendor/autoload.php';
useSpipu\Html2Pdf\Html2Pdf;
useSpipu\Html2Pdf\Exception\Html2PdfException;
useSpipu\Html2Pdf\Exception\ExceptionFormatter;
try {
ob_start();
includedirname(__FILE__).'/res/example14.php';
$content = ob_get_clean();
$html2pdf = newHtml2Pdf('P', 'A4', 'fr');
$html2pdf->setTestIsImage(false);
$html2pdf->setFallbackImage('./res/off.png');
$html2pdf->writeHTML($content);
$html2pdf->output('example14.pdf');
} catch (Html2PdfException$e) {
$html2pdf->clean();
$formatter = newExceptionFormatter($e);
echo$formatter->getHtmlMessage();
}