source: trunk/client/inc/hpdf5/spipu/html2pdf/examples/forms.php@ 407

Last change on this file since 407 was 347, checked in by roby, 3 years ago

Aggiornamento per compatibilità con php7.4

File size: 988 bytes
Line 
1<?php
2/**
3 * Html2Pdf Library - example
4 *
5 * HTML => PDF converter
6 * distributed under the OSL-3.0 License
7 *
8 * @package Html2pdf
9 * @author Laurent MINGUET <webmaster@html2pdf.fr>
10 * @copyright 2017 Laurent MINGUET
11 */
12require_once dirname(__FILE__).'/../vendor/autoload.php';
13
14use Spipu\Html2Pdf\Html2Pdf;
15use Spipu\Html2Pdf\Exception\Html2PdfException;
16use Spipu\Html2Pdf\Exception\ExceptionFormatter;
17
18// for display the post information
19if (isset($_POST['test'])) {
20 echo '<pre>';
21 echo htmlentities(print_r($_POST, true));
22 echo '</pre>';
23 exit;
24}
25
26try {
27 ob_start();
28 require dirname(__FILE__).'/res/forms.php';
29 $content = ob_get_clean();
30
31 $html2pdf = new Html2Pdf('P', 'A4', 'fr');
32 $html2pdf->pdf->SetDisplayMode('fullpage');
33 $html2pdf->writeHTML($content);
34 $html2pdf->output('forms.pdf');
35} catch (Html2PdfException $e) {
36 $html2pdf->clean();
37
38 $formatter = new ExceptionFormatter($e);
39 echo $formatter->getHtmlMessage();
40}
Note: See TracBrowser for help on using the repository browser.