Reputation: 794
I'm trying to figure out how to convert just specific columns into PDF file. In this time I'm able to print just all the columns of the table but I don't need all of them.
This is how I ipmlemented conversion:
function demoPDF() {
var pdf = new jsPDF('l', 'pt', 'a4');
var res = pdf.autoTableHtmlToJson(document.getElementById("tableToConvert"));
pdf.autoTable(res.columns, res.data, {
startY: 60,
tableWidth: 'auto',
columnWidth: 'auto',
styles: {
overflow: 'linebreak'
}
});
pdf.save("pdfExample.pdf");
};
Don't you have any idea how to solve it?
Upvotes: 1
Views: 5824
Reputation: 1686
Check for bold text.
Refer from https://github.com/simonbengtsson/jsPDF-AutoTable
autoTableHtmlToJson(tableElem, includeHiddenElements)
Use it to generate the javascript objects required for this library from an html table (see from html example). IfincludeHiddenElements
is set totrue
hidden rows and columns will be included otherwise excluded.
So, for your case, you need to change the code like below:
var res = pdf.autoTableHtmlToJson(document.getElementById("tableToConvert"), false);
Upvotes: 2