Open krButani opened 1 year ago
hey, I found a way for row and cell stylings which is using pdfkit capabilities in the pdkit-table. You can check this link to draw a rectangle border https://pdfkit.org/docs/vector.html. Simply, use the doc.rect()
function in the prepareRow
hook of table options.
For example, this code sample draws border and fills the cell with a background color:
await doc.table(table, {
/* {options starts} */
..
prepareRow: (row, indexColumn, indexRow, rectRow, rectCell) => {
doc.font('Helvetica').fontSize(9);
doc.rect(rectCell?.x ?? 0,
rectCell?.y ?? 0,
rectCell?.width ?? 0,
rectCell?.height ?? 0)
.fillOpacity(0.5)
.fillAndStroke('red', 'black')
.fillColor('black', 1);
}
/* {options ends} */
});
hope this helps
how to add row or column border and change its property like width, color