我有div
,其中包含一些数据和table
。我现在面临的问题是jspdf
忽略了表的第二列,只打印了每行的第一列。以下是HTML和JS
<div id="myDiv">
<p id="bypassme">Some text</p>
<p>Some more text</p>
<table>
<tr>
<td>First</td>
<td>Second</td>
</tr>
<tr>
<td>Third</td>
<td>Fourth</td>
</tr>
</table>
</div>
<script type="text/javascript">
var doc = new jsPDF('p', 'pt', 'letter');
var html = $('#myDiv').html();
var specialElementHandlers = {
'#bypassme': function(element, renderer){
return true;
}
};
doc.fromHTML(html,10,10, {
'width': 500,
'elementHandlers': specialElementHandlers
});
doc.save("Test.pdf");
</script>
Some text
Some more text
+-------+--------+
| First | Second |
+-------+--------+
| Third | Fourth |
+-------+--------+
Some more text
First
Third
Some more text
First Second
Third Fourth