I have a variable long string. I want to put the text in a pdf. In this pdf One line can fit 72 characters. Sometimes a line is not quite full because a line break was made. How do I find out how many lines the complete text has? But i have to take care, when the word at the end of the line is too long it silps in the next line. So i cannot just split the text by \n or split through 72 chars.
I load the text from a database and then have it as a string.
if i make a console.log() from the String it looks so (that you see what my starting material is)
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam orem ipsum dolor sit amet
orgfdem ipdsum doasdlor sdft amet
orem ipsum doewlor sit aaaadfmet
oradfem iwwpsum doasdlor siaet amet
ordfdfem ipsdsum dosdlor sddit amet