|
| 1 | +<!DOCTYPE html> |
| 2 | +<html> |
| 3 | +<head> |
| 4 | +<title></title> |
| 5 | +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> |
| 6 | +<style> |
| 7 | +.feedback-overlay-black { |
| 8 | + background-color: #000; |
| 9 | + opacity: 0.5; |
| 10 | + position: absolute; |
| 11 | + top: 0; |
| 12 | + left: 0; |
| 13 | + width: 100%; |
| 14 | + height: 100%; |
| 15 | + margin: 0; |
| 16 | +} |
| 17 | +</style> |
| 18 | + |
| 19 | +<style> |
| 20 | +div { |
| 21 | + padding: 20px; |
| 22 | + margin: 0 auto; |
| 23 | + border: 5px solid black; |
| 24 | +} |
| 25 | + |
| 26 | +h1 { |
| 27 | + border-bottom: 2px solid white; |
| 28 | +} |
| 29 | + |
| 30 | +h2 { |
| 31 | + background: #efefef; |
| 32 | + padding: 10px; |
| 33 | +} |
| 34 | +</style> |
| 35 | +</head> |
| 36 | +<body> |
| 37 | + <div style="background: red;"> |
| 38 | + <div style="background: green;"> |
| 39 | + <div style="background: blue; border-color: white;"> |
| 40 | + <div style="background: yellow;"> |
| 41 | + <div style="background: orange;"> |
| 42 | + <h1>Heading</h1> |
| 43 | + Text that isn't wrapped in anything. |
| 44 | + <p> |
| 45 | + Followed by some text wrapped in a <b><p> paragraph.</b> |
| 46 | + </p> |
| 47 | + <p> |
| 48 | + Maybe add a <a href="#">link</a> or a different style of <a href="#" style='font-weight:700;color:purple;font-size:2em' id="highlight">link with a highlight</a>. |
| 49 | + </p> |
| 50 | + <hr /> |
| 51 | + <h2>More content</h2> |
| 52 | + <div style="width: 10px; height: 10px; border-width: 10px; padding: 0;">a</div> |
| 53 | + </div> |
| 54 | + </div> |
| 55 | + |
| 56 | + </div> |
| 57 | + |
| 58 | + </div> |
| 59 | + </div> |
| 60 | + |
| 61 | + <!-- the library --> |
| 62 | + <script type="text/javascript" src="../../jspdf.js"></script> |
| 63 | + <!-- required by the plugin --> |
| 64 | + <script type="text/javascript" src="../../jspdf.plugin.standard_fonts_metrics.js"></script> |
| 65 | + <script type="text/javascript" src="../../jspdf.plugin.split_text_to_size.js"></script> |
| 66 | + <script type="text/javascript" src="../../jspdf.plugin.addimage.js"></script> |
| 67 | + <!-- the plugin --> |
| 68 | + <script type="text/javascript" src="../../jspdf.plugin.context2d.js"></script> |
| 69 | + <script type="text/javascript" src="../../jspdf.plugin.canvas.js"></script> |
| 70 | + |
| 71 | + <script type="text/javascript" src="../../libs/html2canvas/dist/html2canvas.js"></script> |
| 72 | + |
| 73 | + <script type="text/javascript"> |
| 74 | + var pdf = new jsPDF('p', 'pt', 'letter'); |
| 75 | + var canvas = pdf.canvas; |
| 76 | + |
| 77 | + var width = 600; |
| 78 | + //canvas.width=8.5*72; |
| 79 | + document.body.style.width=width + "px"; |
| 80 | + |
| 81 | + html2canvas(document.body, { |
| 82 | + canvas:canvas, |
| 83 | + onrendered: function(canvas) { |
| 84 | + var iframe = document.createElement('iframe'); |
| 85 | + iframe.setAttribute('style', 'position:absolute;top:0;right:0;height:100%; width:600px'); |
| 86 | + document.body.appendChild(iframe); |
| 87 | + iframe.src = pdf.output('datauristring'); |
| 88 | + |
| 89 | + //var div = document.createElement('pre'); |
| 90 | + //div.innerText=pdf.output(); |
| 91 | + //document.body.appendChild(div); |
| 92 | + } |
| 93 | + }); |
| 94 | + </script> |
| 95 | +</body> |
| 96 | +</html> |
0 commit comments