Saravana Kumar
Saravana Kumar

Reputation: 179

String overlaps next column with jspdf-autotable and overflow linebreak

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?

Upvotes: 2

Views: 3757

Answers (1)

Simon Bengtsson
Simon Bengtsson

Reputation: 8151

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 didParseCell.

Upvotes: 1

Related Questions