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,