forked from chiragmaniar/php_website
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhtmltopdf.php
More file actions
47 lines (34 loc) · 760 Bytes
/
htmltopdf.php
File metadata and controls
47 lines (34 loc) · 760 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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<html>
<?php
/*refer video https://www.youtube.com/watch?v=UflTcEFuEyU and https://www.youtube.com/watch?v=PENbtWrVUjI
http://www.webslesson.info/2017/04/convert-html-to-pdf-in-php-using-dompdf.html
*/
$op =
" <table style='width:100%'>
<tr align='left'>
<th>Firstname</th>
<th>Lastname</th>
<th>Age</th>
</tr>
<tr>
<td>Jill</td>
<td>Smith</td>
<td>50</td>
</tr>
<tr>
<td>Eve</td>
<td>Jackson</td>
<td>94</td>
</tr>
</table>" ;
?>
<?php
include_once 'dompdf/dompdf_config.inc.php';
//require_once 'dompdf/dompdf_config.inc.php';
$dompdf = new DOMPDF();
$dompdf->load_html($op);
//$dompdf->setPaper('A4','landscape');
$dompdf->render();
$dompdf->stream('hi',array('Attachment'=>0));
?>
</html>