-
Notifications
You must be signed in to change notification settings - Fork 0
/
datos.html
74 lines (64 loc) · 1.81 KB
/
datos.html
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
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>Datos personales </title> </head>
<style type="text/css">
li,button{
font-size:16pt;
}
</style>
</head>
<body background="img/fondo.jpg">
<h1 style="color:blue"><u><center>Datos Personales</center></u></h1>
<div class="form" >
<br>
<ul>
<li><b>Nombres:</b> Brandon Alexmir</li>
<br><li><b>Apellidos:</b> Palacios Zamudio</li>
<br><li> <b>DNI:</b> 72488150 </li>
<br> <li> <b> Edad:</b> 23 años </li>
<br><li> <b>Código:</b> 0201214004 </li>
<br> <li> <b>Correo:</b> [email protected] </li>
<br><li><b>Dirección:</b> Nicolas Garatea MZ 42 - LT 28 </li>
</ul>
</div>
<div align="center">
<button id="crear" align="center" style="background-color:#0000FF">Generar pdf</button>
</div>
<script src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
<script type="text/javascript" src="js/jspdf1.min.js"></script>
<script type="text/javascript" src="js/html2canvas1.min.js"></script>
<script type="text/javascript">
(function(){
var form = $('.form'),cache_width = form.width(), a4 =[ 595.28, 841.89]; // for a4 size paper width and height
$('#crear').on('click',function(){
$('body').scrollTop(0);
createPDF();
});
//create pdf
function createPDF(){
getCanvas().then(function(canvas){
var
img = canvas.toDataURL("image/png"),
doc = new jsPDF({
unit:'px',
format:'a4'
});
doc.addImage(img, 'JPEG', 20, 20);
doc.save('techumber-html-to-pdf.pdf');
form.width(cache_width);
});
}
// create canvas object
function getCanvas(){
form.width((a4[0]*1.33333) -80).css('max-width','none');
return html2canvas(form,{
imageTimeout:2000,
removeContainer:true
});
}
}());
</script>
</body>
</html>