<div id="content">
<h3>Hello</h3>
<table id = "tblHeader" >
<tbody>
<tr>
<td width="10%">name</td>
<td width="15%">id</td>
<td width="27%">Patient Name </td>
<td width="8%">Age</td>
</tr>
</tbody>
</table>
</div>
<button id="cmd">generate PDF</button>
This table I need to convert to pdf.
I tried with jspdf and the function noted below.
$(function () {
$('#cmd').click(function () {
var pdf = new jsPDF('p', 'pt', 'letter'),
source = $('#tblHeader')[0],
margins = {
top: 40,
bottom: 40,
left: 40,
right: 40,
width: 522
};
pdf.fromHTML(
source,
margins.left,
margins.top,
{
'width': margins.width
},
function (dispose) {
pdf.save('Test.pdf');
},
margins
);
});
});
And it generated pdf with column data as rows.Please help me.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…