Initial commit
This commit is contained in:
40
html2pdf-master/examples/forms.php
Normal file
40
html2pdf-master/examples/forms.php
Normal file
@ -0,0 +1,40 @@
|
||||
<?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;
|
||||
|
||||
// for display the post information
|
||||
if (isset($_POST['test'])) {
|
||||
echo '<pre>';
|
||||
echo htmlentities(print_r($_POST, true));
|
||||
echo '</pre>';
|
||||
exit;
|
||||
}
|
||||
|
||||
try {
|
||||
ob_start();
|
||||
require dirname(__FILE__).'/res/forms.php';
|
||||
$content = ob_get_clean();
|
||||
|
||||
$html2pdf = new Html2Pdf('P', 'A4', 'fr');
|
||||
$html2pdf->pdf->SetDisplayMode('fullpage');
|
||||
$html2pdf->writeHTML($content);
|
||||
$html2pdf->output('forms.pdf');
|
||||
} catch (Html2PdfException $e) {
|
||||
$html2pdf->clean();
|
||||
|
||||
$formatter = new ExceptionFormatter($e);
|
||||
echo $formatter->getHtmlMessage();
|
||||
}
|
Reference in New Issue
Block a user