|
| 1 | +<!doctype html> |
| 2 | +<!-- |
| 3 | +/** |
| 4 | + * jsPDF Test HTML PlugIn |
| 5 | + * Copyright (c) 2014 Steven Spungin (TwelveTone LLC) [email protected] |
| 6 | + * |
| 7 | + * Licensed under the MIT License. |
| 8 | + * http://opensource.org/licenses/mit-license |
| 9 | + */ |
| 10 | +--> |
| 11 | + |
| 12 | +<html> |
| 13 | +<head> |
| 14 | +<meta http-equiv="content-type" content="text/html; charset=UTF-8"> |
| 15 | + |
| 16 | +<title>Test HTML</title> |
| 17 | + |
| 18 | +<!-- Required Files --> |
| 19 | +<script type="text/javascript" src="../jspdf.js"></script> |
| 20 | +<!-- Plugin Dependencies --> |
| 21 | +<script type="text/javascript" src="../jspdf.plugin.standard_fonts_metrics.js"></script> |
| 22 | +<script type="text/javascript" src="../jspdf.plugin.split_text_to_size.js"></script> |
| 23 | +<script type="text/javascript" src="../jspdf.plugin.from_html.js"></script> |
| 24 | +<!-- Plugin To Test --> |
| 25 | +<script type="text/javascript" src="test_harness.js"></script> |
| 26 | +<!-- Test Dependencies --> |
| 27 | + |
| 28 | +<script> |
| 29 | + pdf_test_harness.onload = function(harness) { |
| 30 | + var pdf = new jsPDF('p', 'pt', 'letter'); |
| 31 | + var ta = document.getElementById('textarea'); |
| 32 | + |
| 33 | + pdf.fromHTML(ta.value, 0, 0); |
| 34 | + |
| 35 | + ta.onkeyup = function(){ |
| 36 | + var pdf = new jsPDF('p', 'pt', 'letter'); |
| 37 | + pdf.fromHTML(ta.value, 0, 0); |
| 38 | + harness.setPdf(pdf); |
| 39 | + } |
| 40 | + |
| 41 | + harness.header.style.left='300px'; |
| 42 | + harness.body.style.left='300px'; |
| 43 | + |
| 44 | + return pdf; |
| 45 | + } |
| 46 | + |
| 47 | + |
| 48 | +</script> |
| 49 | + |
| 50 | +</head> |
| 51 | + |
| 52 | +<body style='background-color: silver; margin: 0;'> |
| 53 | +<textarea id='textarea' style='position:fixed;left:0;width:290px;height:100%'> |
| 54 | + |
| 55 | +<html> |
| 56 | +<head> |
| 57 | +<style> |
| 58 | +.break{ |
| 59 | +page-break-before:always; |
| 60 | +} |
| 61 | +body{ |
| 62 | +font-size:2em; |
| 63 | +} |
| 64 | +</style> |
| 65 | +</head> |
| 66 | +<body> |
| 67 | + <div>page 1 <em>ok?</em></div> |
| 68 | + <div class='break'>page 2</div> |
| 69 | + <div class='break' style='margin-top:1in'>page 3</div> |
| 70 | +</body> |
| 71 | +</html> |
| 72 | + |
| 73 | +</textarea> |
| 74 | +</body> |
| 75 | +</html> |
0 commit comments