String overlaps next column with jspdf-autotable a

2019-07-22 13:45发布

问题:

I'm using jspdf-autoTable with the option overflow: 'linebreak' to create a pdf. The problem is that some long texts are overlapping the next column. For example, if my text is "Hai hello welcome" it will print as "Hai hello wel" with the remaining "come" overlapped on the next column. How can I use linebreak without overlapping the next column?

Note: Linebreak works fine until I'm changing the text in the drawCell method.

I get this weird behavior as well:

What I send in:

Paragraph writing is the foundation of all essay writing whether the form is expository persuasive narrative or creative

Inside my drawCell method:

["Paragraph writing is the foundation of all","essay writing whether the form is expository","persuasive narrative or creative"]

I don't know why it automatically divided the string into an array. Could this be the reason for the overlapping issue?

回答1:

It is expected that the string turns into an array. The jspdf lib will print each string in the array on a new line. If you want to change the string with hooks, use the createdCell hook instead of drawCell.