fastadmin/public/assets/libs/jspdf/examples/test_from_html.html

79 lines
1.7 KiB
HTML

<!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>
<script src='../libs/require/require.js'></script>
<script>
require_baseUrl_override = '../';
require(['../libs/require/config'], function(){
require(['test/test_harness', 'plugins/from_html'], function(){
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);
}
var harness = pdf_test_harness_init(pdf);
harness.header.style.left='50%';
harness.body.style.left='50%';
}); //require
}); //require
</script>
</head>
<body style='background-color: silver; margin: 0;'>
<textarea id='textarea' style='position: fixed; width: 50%; height: 100%'>
<html>
<head>
<style>
.important {
color: darkred;
font-size: 10em;
}
</style>
</head>
<body>
<div>black</div>
<div>black (should not have color parameter in PDF source)</div>
<div style='color: red; font-size: 30px'>hello</div>
<div style='color: rgb(0, 255, 0); font-size: 30px'>hello</div>
<div style='color: #0000FF; font-size: 30px'>hello</div>
<div class='important'>hello</div>
<div>black</div>
<div>black (should not have color parameter in PDF source)</div>
</body>
</html>
</textarea>
</body>
</html>