Exclude Columns in jsPDF AutoTable

我与影子孤独终老i 提交于 2019-12-08 05:33:55

问题


Has somebody experience excluding the columns in the pdf result from a Table using jsPDF autoTable..Would appriciate a little help.


回答1:


Anyway, after digging deep in the API and in the examples. I found a solution. jsPDF with autoTable is kinda tricky specially for beginners so for those who will bump in to this predicament in the near fututre. Here's how:

var tTB = document.getElementById("myTable");
var atTB = doc.autoTableHtmlToJson(tTB, true);
var cols = atTB.columns;
//here you are going to set which column you will truncate. Moreover, .splice(index number of the column(your start), the number of columns you will exclude)
cols.splice(4,1); 
doc.text("My Test Table", 40, 60);
doc.autoPrint();

cheers!




回答2:


Well you can use http://pdfmake.org/ to generate pdf client side. It is much simpler to write a pdf using this library. They also have playground to copy paste your code and watch live pdf.

Thanks,



来源:https://stackoverflow.com/questions/40254744/exclude-columns-in-jspdf-autotable

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!