jsPDF Autotable Tutorial: Give Different Widths to Columns & Rows of Table in PDF Document

You have to convert your columnWidth array to look like this:

doc.autoTable({
  html: '#table',
  columnStyles: {
    0: {cellWidth: 100},
    1: {cellWidth: 80},
    2: {cellWidth: 80},
    // etc
  }
});

A point to be noted is that here we used columnStyles instead of styles.

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.