I am working with jsPDF and have a variable joke and use .splitTextToSize to have it display nicely on the page.
var doc = new jsPDF()
var joke = "A Computer Science student at MIT showed up at his buddies dorm room with a new bike. His buddy said sweet bike, where’d ya get it? You’ll never believe this, he said, I was walking across campus and this beautiful blonde on a bike stopped, threw down her bike, tore off all her clothes and said _take whatever you want!_ His buddy stared at him blankly for a minute, then said smart. Her clothes would have never fit you.";
var line = doc.splitTextToSize(joke, 100)
doc.text(10,10, line)
The document now contains the following.
A Computer Science student at MIT
showed up at his buddies dorm room
with a new bike. His buddy said sweet
bike, where’d ya get it? You’ll never
believe this, he said, I was walking
across campus and this beautiful
blonde on a bike stopped, threw down
her bike, tore off all her clothes and
said _take whatever you want!_
His buddy stared at him blankly for a
minute, then said smart. Her clothes
would have never fit you.
Is there way to get the split var line
and retrieve the last three line of the string? I was wondering if you can split by line number
His buddy stared at him blankly for a
minute, then said smart. Her clothes
would have never fit you.