-
Notifications
You must be signed in to change notification settings - Fork 749
/
measure.php
32 lines (28 loc) · 850 Bytes
/
measure.php
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
<?php
/**
* Html2Pdf Library - example
*
* HTML => PDF converter
* distributed under the OSL-3.0 License
*
* @package Html2pdf
* @author Laurent MINGUET <[email protected]>
* @copyright 2023 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/measure.php';
$content = ob_get_clean();
$html2pdf = new Html2Pdf('L', 'A4', 'fr', true, 'UTF-8', 10);
$html2pdf->pdf->SetDisplayMode('fullpage');
$html2pdf->writeHTML($content);
$html2pdf->output('measure.pdf');
} catch (Html2PdfException $e) {
$html2pdf->clean();
$formatter = new ExceptionFormatter($e);
echo $formatter->getHtmlMessage();
}