0

我想下载表格内容的 pdf 文件。为此,我使用的是 jsPDF-AutoTable 库。但是当我下载文件时,它只下载一页。我的代码如下。请告诉我,我应该在我的代码?

<script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/1.3.2/jspdf.min.js"</script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf-autotable/2.3.2/jspdf.plugin.autotable.js"></script>
<script>
function download_pdf(val) {
    if (val == 3) {
       var doc = new jsPDF('p', 'pt');
       var elem = document.getElementById("myTable");
       var res = doc.autoTableHtmlToJson(elem);
       doc.autoTable(res.columns, res.data,{ 
       styles: {overflow: 'linebreak'},
       columnStyles: {
       0: {columnWidth: 50}, 
       1:{columnWidth:50}, 
       2: {columnWidth: 50}, 
       3: {columnWidth: 40},
       4: {columnWidth: 40}, 
       5:{columnWidth:40}, 
       6: {columnWidth: 40}, 
       7: {columnWidth: 40},
       8: {columnWidth: 40}, 
       9:{columnWidth:40}, 
       10: {columnWidth: 40}, 
       11: {columnWidth: 40},
       12: {columnWidth: 40}
       }
       });
       doc.save("can_data_report.pdf");
   }
}
</script>
4

0 回答 0