|
15 | 15 |
|
16 | 16 | <title>Test HTML</title> |
17 | 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 --> |
| 18 | +<script src='../libs/require/require.js'></script> |
27 | 19 |
|
28 | 20 | <script> |
29 | | - pdf_test_harness.onload = function(harness) { |
30 | | - var pdf = new jsPDF('p', 'pt', 'letter'); |
| 21 | +require_baseUrl_override = '../'; |
| 22 | + |
| 23 | +require(['../libs/require/config'], function(){ |
| 24 | +require(['test/test_harness', 'jspdf.plugin.from_html'], function(){ |
| 25 | + |
| 26 | + var pdf = new jsPDF('p', 'pt', 'letter'); |
31 | 27 | var ta = document.getElementById('textarea'); |
32 | | - |
33 | | - pdf.fromHTML(ta.value, 0, 0); |
34 | | - |
35 | | - ta.onkeyup = function(){ |
| 28 | + |
| 29 | + pdf.fromHTML(ta.value, 0, 0); |
| 30 | + |
| 31 | + ta.onkeyup = function(){ |
36 | 32 | var pdf = new jsPDF('p', 'pt', 'letter'); |
37 | | - pdf.fromHTML(ta.value, 0, 0); |
38 | | - harness.setPdf(pdf); |
39 | | - } |
40 | | - |
| 33 | + pdf.fromHTML(ta.value, 0, 0); |
| 34 | + harness.setPdf(pdf); |
| 35 | + } |
| 36 | + |
| 37 | + var harness = pdf_test_harness_init(pdf); |
41 | 38 | harness.header.style.left='50%'; |
42 | 39 | harness.body.style.left='50%'; |
43 | | - |
44 | | - return pdf; |
45 | | - } |
| 40 | + |
| 41 | +}); //require |
| 42 | +}); //require |
46 | 43 | </script> |
47 | 44 |
|
48 | 45 | </head> |
49 | 46 |
|
50 | 47 | <body style='background-color: silver; margin: 0;'> |
51 | | - <textarea id='textarea' style='position:fixed;width: 50%;height:100%'> |
| 48 | + <textarea id='textarea' style='position: fixed; width: 50%; height: 100%'> |
52 | 49 |
|
53 | 50 | <html> |
54 | 51 | <head> |
55 | 52 | <style> |
56 | | - .important |
57 | | - { |
58 | | - color:darkred ; font-size:10em; |
59 | | - } |
| 53 | +.important { |
| 54 | + color: darkred; |
| 55 | + font-size: 10em; |
| 56 | +} |
60 | 57 | </style> |
61 | 58 | </head> |
62 | 59 | <body> |
63 | 60 | <div>black</div> |
64 | 61 | <div>black (should not have color parameter in PDF source)</div> |
65 | 62 |
|
66 | | - <div style='color: red;font-size:30px'>hello</div> |
67 | | - <div style='color: rgb(0,255,0);font-size:30px'>hello</div> |
68 | | - <div style='color: #0000FF;font-size:30px'>hello</div> |
| 63 | + <div style='color: red; font-size: 30px'>hello</div> |
| 64 | + <div style='color: rgb(0, 255, 0); font-size: 30px'>hello</div> |
| 65 | + <div style='color: #0000FF; font-size: 30px'>hello</div> |
69 | 66 |
|
70 | 67 | <div class='important'>hello</div> |
71 | 68 |
|
|
0 commit comments