I’m using jsPDF Autotable to generate a PDF from an HTML table. The TD element contains an ID that populates the cell with a variable . Everything works fine, but I wanted to set the textColor to red for negative values. I can’t find an example of how to achieve this?
EDIT: I solved making the bottom row of a table red when the values are negative using a hook...
drawCell: function (cell, data) {
if (summary_balance_weekly <0) {
if (data.row.index === data.table.rows.length - 1) {
doc.setTextColor(255,0,0);
}
}
}