Jspdf-autotable: Error: Invalid arguments passed to jsPDF.rect (cellWidth: 'wrap' with colSpan)

Created on 24 Oct 2019  路  4Comments  路  Source: simonbengtsson/jsPDF-AutoTable

When using cellWidth: 'wrap' with a column that has collSpan in one of its rows, I get the error :
Error: Invalid arguments passed to jsPDF.rect.

codepen: https://codepen.io/mmghv/pen/gOOWMqx?editors=1010

I tracked down the problem to this section :
https://github.com/simonbengtsson/jsPDF-AutoTable/blob/c8ba085bcd623a5e0327af625eaabcf646ce1bdb/src/inputParser.ts#L209-L213

if cellWidth is 'warp' in columnStyles, it will be assign to column.minWidth and column.wrappedWidth which will cause width calculations to be NaN or number + string later on.

I left this one for you to fix because I don't know if this should also be fixed elsewhere or if we need to handle 'wrap' differently here or just check for the typeof.

Most helpful comment

haha we spent all day yesterday digging into the inputParser and writing up a ticket, was about to submit this morning and saw the fix was already in! Thanks for fixing this so quickly.

All 4 comments

I'm fairly confident a typeof check will fix it since code was added only as a way to make sure cellWidth works for columnStyles even if there are no cells in that column. Thanks for the issue report! Will add you as collaborator now as well considering the high quality issues and pull request you have submitted. Feel free making any changes you'd like 馃憤

Wow, That's a great honor and a responsibility I don't know if I'm suited for, I'm usually busy so I'm not offering much but I will contribute whenever I have a chance.

Thank you for the trust.

haha we spent all day yesterday digging into the inputParser and writing up a ticket, was about to submit this morning and saw the fix was already in! Thanks for fixing this so quickly.

@thebrubaker Happens to the best of us :smile:

Was this page helpful?
0 / 5 - 0 ratings

Related issues

bsparacino picture bsparacino  路  3Comments

Alorse picture Alorse  路  4Comments

prakashsam picture prakashsam  路  4Comments

cwolcott picture cwolcott  路  4Comments

ayozebarrera picture ayozebarrera  路  3Comments