question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

text() method removes existing newlines when maxWidth is given

See original GitHub issue

Hi! It is very powerful library but I’ve found one small bug. If I use Text method with only one option it will correctly reproduce carriage return var pDoc = new jsPDF('p','mm','a4'); pDoc.text('Some text on first line\rSome text on second line', 105, 10, 'center'); but if I use option maxWidth then carriage returns are ignored var pDoc = new jsPDF('p','mm','a4'); pDoc.text('Some text on first line\rSome text stay on same line', 105, 10, {align: 'center', maxWidth: 190);

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:8

github_iconTop GitHub Comments

1reaction
SimonChaumetcommented, May 28, 2020

I think we can argue this is by design. Although preserving existing newlines is probably a good idea. I’ll mark it as an improvement rather than a bug.

If you don’t want to correct it, at least update the documentation to specify it.

0reactions
github-actions[bot]commented, Feb 26, 2021

This issue is stale because it has been open 90 days with no activity. It will be closed soon. Please comment/reopen if this issue is still relevant.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cause line to wrap to new line after 100 characters
Your line isn't breaking naturally because you don;t have any spaces in it. You can use word-wrap to force the breaks, then add...
Read more >
textwrap — Text wrapping and filling — Python 3.11.1 ...
Wraps the single paragraph in text (a string) so every line is at most width characters long. Returns a list of output lines,...
Read more >
text-overflow - CSS: Cascading Style Sheets - MDN Web Docs
The text-overflow CSS property sets how hidden overflow content is signaled to users. It can be clipped, display an ellipsis ('…
Read more >
overflow-wrap | CSS-Tricks
The overflow-wrap property in CSS allows you to specify that the browser can break a line of text inside the targeted element onto...
Read more >
Textwrap – Text wrapping and filling in Python - GeeksforGeeks
replace_whitespace: It's default value is set to TRUE. If the value is true, after tab expansion but before wrapping, the wrap() method replaces ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found