我正在尝试使用jsPDF生成报告,除了rowpan和colspan之外,它们都可以正常工作,而不是让它们undefined
起作用。我在下面提供了详细信息
HTML:
<script src="https://cdnjs.cloudflare.com/ajax/libs/html2canvas/0.4.1/html2canvas.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/1.0.272/jspdf.debug.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf-autotable/2.3.2/jspdf.plugin.autotable.js"></script>
<div class="container"><table id="table-id"><tr><th>Name</th><th>Cell</th><th>Email</th><th>Website</th></tr><tr><td>Md. Bablu Mia</td><td rowspan="2">01730910</td><td>bablu@gmail.com</td><td>w3public.com</td></tr><tr><td>Faruk Ahmed</td><td>bablu2@gmail.com</td><td>w3outlook.com</td></tr><tr><td>Rahim</td><td>017309111</td><td colspan="2">rahim@gmail.com</td></tr></table></div>
<a href="javascript:pdfReport()">PDF Download</a>
JS:
function pdfReport(){
let doc = new jsPDF('p', 'pt', 'a4');
let fileName = 'new_name';
let newFileName = fileName ? (fileName + '.pdf') : 'report.pdf';
let margins = {
top: 10,
bottom: 60,
left: 50,
width: 800
};
let options = {
'width': margins.width, // max width of content on PDF
pagesplit: true
};
//doc.autoPrint();
doc.fromHTML(
$('.container').get(0), //html
margins.left, // x coord
margins.top, // y coord
options,
function (dispose) {
doc.save(newFileName);
}, margins);
}
有人可以帮助我吗?
预先感谢