forked from spipu/html2pdf
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjs3.php
35 lines (31 loc) · 949 Bytes
/
js3.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
33
34
35
<?php
/**
* Html2Pdf Library - example
*
* HTML => PDF converter
* distributed under the OSL-3.0 License
*
* @package Html2pdf
* @author Laurent MINGUET <[email protected]>
* @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;
try {
$content = "
<page>
<h1>Test de JavaScript 3</h1><br>
<br>
Normalement une valeur devrait vous être demandée, puis affichée
</page>";
$script = "var rep = app.response('Donnez votre nom'); app.alert('Vous vous appelez '+rep);";
$html2pdf = new Html2Pdf('P', 'A4', 'fr');
$html2pdf->pdf->IncludeJS($script);
$html2pdf->writeHTML($content);
$html2pdf->output('js3.pdf');
} catch (Html2PdfException $e) {
$formatter = new ExceptionFormatter($e);
echo $formatter->getHtmlMessage();
}