forked from eKoopmans/html2pdf.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtemplate.html
44 lines (38 loc) · 1.03 KB
/
template.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
<!DOCTYPE HTML>
<html>
<head>
<title>html2pdf Test - Template</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<style type="text/css">
/* Basic styling for root. */
#root {
width: 500px;
height: 700px;
background-color: yellow;
}
</style>
</head>
<body>
<!-- Button to generate PDF. -->
<button onclick="test()">Generate PDF</button>
<!-- Div to capture. -->
<div id="root">
This is a test
</div>
<!-- Include html2pdf bundle. -->
<script src="../../dist/html2pdf.bundle.js"></script>
<script>
function test() {
// Get the element.
var element = document.getElementById('root');
// Generate the PDF.
html2pdf().from(element).set({
margin: 1,
filename: 'test.pdf',
html2canvas: { scale: 2 },
jsPDF: {orientation: 'portrait', unit: 'in', format: 'letter', compressPDF: true}
}).save();
}
</script>
</body>
</html>