0
我想将这个表格生成一个pdf文件。但它只显示一列。如何将html表转换为pdf?
连续(<tr>
)我使用了2列(<td> </td> <td> </td>
)。
但它不显示第二列。
这是表格。
<table class="table">
<tr>
<th colspan="2"> <strong> Student Details</strong><th></th> </th>
</tr>
<tr>
<td style="width: 100px;">
<h:outputText value="Student Name"/></td>
<td> <h:outputText value="#{collect.s_name}" />
</td></tr>
</table>
这是脚本
<script>
// <![CDATA[
function generate() {
var doc = new jsPDF('p', 'px');
var res = doc.autoTableHtmlToJson(document.getElementById("example2"));
var res1 = doc.autoTableHtmlToJson(document.getElementById("example3"));
for (var j = 0; j < 6; j++) {
doc.autoTable(res.columns, res.data ,{
tableWidth: '800',
headerStyles: {rowHeight: 12, fontSize: 9,valign: 'middle' },
bodyStyles: {rowHeight: 10, fontSize: 8, valign: 'middle'},
startY:20,
theme: 'grid',overflow: 'linebreak'
});
}
doc.save("fee-report_#{collect.dept_name}.pdf");
};
制定你的标题为圆形,清晰的问题可以有很大的帮助,以获得有用的答案。 – peterh