Autopaging jspdf when content increases

Refresh

April 2019

Views

4 time

0

I'm trying to create a pdf that auto-pages when a content increases. This is my sample code. Any help would be greatly appreciated :)

HTML code

<button click = "previewPdf(data)"> Preview </button>

Javascript

preview(data) {
  var doc = new jsPDF();
  let bodyContent = doc.splitTextToSize(data.body, 250);
  let lineheight = 6;
  let offsety = 5;

  this.data.forEach(function(i) {
  doc.text(10,10 + lineheight * 0 + offsety, bodyContent);
  doc.output("dataurlnewwindow");
});

}

JSON

data[{
  "body": "A very long letter content...";
}];

0 answers