forked from parallax/jsPDF
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_from_html_css_page_breaks.html
More file actions
75 lines (61 loc) · 1.77 KB
/
Copy pathtest_from_html_css_page_breaks.html
File metadata and controls
75 lines (61 loc) · 1.77 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
<!doctype html>
<!--
/**
* jsPDF Test HTML PlugIn
* Copyright (c) 2014 Steven Spungin (TwelveTone LLC) steven@twelvetone.tv
*
* Licensed under the MIT License.
* http://opensource.org/licenses/mit-license
*/
-->
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>Test HTML</title>
<!-- Required Files -->
<script type="text/javascript" src="../jspdf.js"></script>
<!-- Plugin Dependencies -->
<script type="text/javascript" src="../jspdf.plugin.standard_fonts_metrics.js"></script>
<script type="text/javascript" src="../jspdf.plugin.split_text_to_size.js"></script>
<script type="text/javascript" src="../jspdf.plugin.from_html.js"></script>
<!-- Plugin To Test -->
<script type="text/javascript" src="test_harness.js"></script>
<!-- Test Dependencies -->
<script>
pdf_test_harness.onload = function(harness) {
var pdf = new jsPDF('p', 'pt', 'letter');
var ta = document.getElementById('textarea');
pdf.fromHTML(ta.value, 0, 0);
ta.onkeyup = function(){
var pdf = new jsPDF('p', 'pt', 'letter');
pdf.fromHTML(ta.value, 0, 0);
harness.setPdf(pdf);
}
harness.header.style.left='300px';
harness.body.style.left='300px';
return pdf;
}
</script>
</head>
<body style='background-color: silver; margin: 0;'>
<textarea id='textarea' style='position:fixed;left:0;width:290px;height:100%'>
<html>
<head>
<style>
.break{
page-break-before:always;
}
body{
font-size:2em;
}
</style>
</head>
<body>
<div>page 1 <em>ok?</em></div>
<div class='break'>page 2</div>
<div class='break' style='margin-top:1in'>page 3</div>
</body>
</html>
</textarea>
</body>
</html>