CSS To PDF
Convert HTML Css to PDF and Print
HTML
<script src="http://cdnjs.cloudflare.com/ajax/libs/raphael/2.1.0/raphael-min.js"></script>
<script src="http://cdn.oesmith.co.uk/morris-0.4.1.min.js"></script>
<script src="http://xep.cloudformatter.com/doc/js/xepOnline.jqPlugin.008.js"></script>
<body>
<div id="line-example" style="width:100%"></div>
<button id="print">PDF</button>
</body>
JavaScript
Morris.Line({
element: 'line-example',
data: [
{ y: '2006', a: 100, b: 90 },
{ y: '2007', a: 75, b: 65 },
{ y: '2008', a: 50, b: 40 },
{ y: '2009', a: 75, b: 65 },
{ y: '2010', a: 50, b: 40 },
{ y: '2011', a: 75, b: 65 },
{ y: '2012', a: 100, b: 90 }
],
xkey: 'y',
ykeys: ['a', 'b'],
labels: ['Series A', 'Series B']
});
$('#print').click(function () {
printMe();
});
// This will render SVG only as PDF and download
function printMe() {
xepOnline.Formatter.Format('line-example', {render:'download', srctype:'svg'});
}