http://raw.githack.com/MrRio/jsPDF/master/ /* * Let's demonstrate string splitting with the first page of Shakespeare's Romeo and Juliet! * We'll use a 8.5 x 11 inch sheet, measuring everything in inches. */ var pageWidth = 8.5, lineHeight = 1.2, margin = 0.5, maxLineWidth = pageWidth - margin * 2, fontSize = 24, ptsPerInch = 72, oneLineHeight = (fontSize * lineHeight) / ptsPerInch, text = "Two households, both alike in dignity,\n" + "In fair Verona, where we lay our scene,\n" + "From ancient grudge break to new mutiny,\n" + "Where civil blood makes civil hands unclean.\n" + "From forth the fatal loins of these two foes\n" + "A pair of star-cross'd lovers take their life;\n" + "Whole misadventured piteous overthrows\n" + "Do with their death bury their parents' strife.\n" + "...