Friday, 11 February 2022

jsPDF Autotable API?

Just found the Autotable plugin for jsPDF and there seems to be a little bit of a learning curve for me as I try to use this. I see the examples.js that comes with the file, but is there a full API somewhere where I can see all methods?

For example the didParseCell section there is this code:

  // Use for customizing texts or styles of specific cells after they have been formatted by this plugin.
// This hook is called just before the column width and other features are computed.
  didParseCell: function (data) {
  if (data.row.index === 5) {
    data.cell.styles.fillColor = [40, 170, 100]
  }

  if (
    (data.row.section === 'head' || data.row.section === 'foot') &&
    data.column.dataKey === 'expenses'
  ) {
    data.cell.text = '' // Use an icon in didDrawCell instead
  }

  if (data.column.dataKey === 'city') {
    data.cell.styles.font = 'mitubachi'
    if (data.row.section === 'head') {
      data.cell.text = 'シティ'
    }
    if (data.row.index === 0 && data.row.section === 'body') {
      data.cell.text = 'とうきょう'
    }
  }
},

I'd like to know what methods/properties I can access for "data". Is there a full API that lists these somewhere?



from jsPDF Autotable API?

No comments:

Post a Comment