Shinseiki86
Shinseiki86

Reputation: 11

jsPDF-AutoTable: Image does not match the row to change pages

I appreciate the help for the following with jsPDF AutoTable v2.3.0.

I have a table with images in the first column with the following style:

styles: {overflow: 'linebreak', columnWidth: 'wrap'},
    columnStyles: {
        0: {columnWidth: 25},
        1: {columnWidth: 350}
},

When the table occupies two pages, the images do not fit correctly in the row.

Example: https://jsfiddle.net/shinseiki86/60qrh6e1/

Result: https://i.sstatic.net/PykQw.png

Thanks!

Upvotes: 0

Views: 1355

Answers (1)

Shinseiki86
Shinseiki86

Reputation: 11

Fixed using the issue reported in the following link:

  drawCell: function(cell, opts) {
    if (opts.column.dataKey === 0 && opts.row.index < data.rows.length) {
      images.push({
        elem: imgElements[opts.row.index],
        x: cell.textPos.x,
        y: cell.textPos.y
      });
    }
  },

Solution: https://jsfiddle.net/shinseiki86/j5dz8dv8/

Upvotes: 0

Related Questions