-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdemo3.php
More file actions
120 lines (111 loc) · 3.86 KB
/
Copy pathdemo3.php
File metadata and controls
120 lines (111 loc) · 3.86 KB
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
<?php
include 'mpdf/mpdf.php';
?>
<div id="coba">
<table id="license" width="423" height="468" border="0" cellpadding="2">
<tr>
<td height="48" colspan="3"><div align="center">
<h3>SMK HIGH SCHOOL</h3>
</div></td>
</tr>
<tr>
<td colspan="3"><div align="center">LICENSE</div></td>
</tr>
<tr>
<td height="47" colspan="3"><div>Explain that students below:</div></td>
</tr>
<tr>
<td height="29" colspan="3">Name : <div style="display: inline" id="studentName">Alex</div></td>
</tr>
<tr>
<td height="30" colspan="3">Class : <div style="display: inline" id="studentClass">X NET 1</div></td>
</tr>
<tr>
<td height="31" colspan="3">Date : <div style="display: inline" id="studentDate">03-09-2016</div></td>
</tr>
<tr>
<td height="32" colspan="3"><div align="justify">Description : <div style="display: inline" id="studentDes">description</div></div></td>
</tr>
<tr>
<td height="10" colspan="3"> </td>
</tr>
<tr>
<!---------------two column---------------------------------------->
<td><div align="center" class="space">Tentor Main Tentor</div></td>
<!--<td colspan="2"><div align="center">Main Tentor</div></td>-->
</tr>
<tr>
<td width="230" height="50"> </td>
<!--<td width="182" colspan="2"> </td>-->
</tr>
<tr>
<td height="51"><div align="center" class="space">(..........................................) (...........................................)</div></td>
<!--<td colspan="2"><div align="center">(...........................................)</div></td>-->
</tr>
</table>
</div>
<button type="button" class="btn btn-default" onclick="PrintElem('#coba')" >Submit Data</button>
<style>
.space{
white-space: pre;
}
</style>
<script src="dist/jspdf.min.js"></script>
<script src="dist/jspdf.plugin.autotable.js"></script>
<script src="lib/jquery.min.js"></script>
<script>
function printout()
{
// var doc = new jsPDF('p','pt','b6');
// var lic = $('#coba').clone();
//// var elem = document.getElementById("license");
//// var res = doc.autoTableHtmlToJson(elem);
//// doc.autoTable(res.columns, res.data, {theme:'plain'});
// doc.fromHTML(lic.get(0),0,10,{});
// doc.output('dataurlnewwindow');
var doc=new jsPDF('p','pt','b6');
source = $('#license')[0];
specialElementHandlers =
{
'#bypassme':function(element,renderer)
{
return true;
}
}
margins=
{
top:50,left:60,width:500
};
doc.fromHTML
(
source, margins.left, margins.top,
{
'width':margins.width, 'elementHandlers':specialElementHandlers
},
function(dispose)
{
doc.output('dataurlnewwindow');
}
)
// doc.output('dataurlnewwindow');
}
function PrintElem(elem)
{
Popup($(elem).html());
}
function Popup(data)
{
var mywindow = window.open('', 'my div', 'height=800,width=600');
mywindow.document.write('<html><head><title>my div</title>');
/*optional stylesheet*/ //mywindow.document.write('<link rel="stylesheet" href="main.css" type="text/css" />');
mywindow.document.write('</head><body >');
mywindow.document.write(data);
mywindow.document.write('</body></html>');
mywindow.document.write('<style>.space{white-space: pre;}</style>');
mywindow.document.close(); // necessary for IE >= 10
mywindow.focus(); // necessary for IE >= 10
mywindow.print();
mywindow.close();
return true;
}
</script>