I am using jspdf for making html data to table.I make pdf with html data but data not showing as formatted tableMy sample code
var doc = new jsPDF();
var specialElementHandlers = {
'#editor': function (element, renderer) {
return true;
}
};
$('#gen_pdf').click(function () {
doc.fromHTML($('#make_pdf').html(), 15, 15, {
'width': 170,
'elementHandlers': specialElementHandlers
});
doc.save('student_result.pdf');
});
and sample table
<div class="form-group" id="make_pdf">
<table id="tbl" class="table table-bordered">
<tbody>
<td>Course Code</td>
<td>Name</td>
<td>Grade</td>
</tbody>
</table>
</div>
How can I show table data to pdf as formatted table.
Unfortunately tables are not supported by jsPDF but there's a third party library that does a really great job it's called jsPDF-AutoTable. It's also very easy to use.
You can download it from here: https://github.com/simonbengtsson/jsPDF-AutoTable