0

How to generate pdf from 2d array, as mentioned below, in JavaScript Sample Array var datasets=[[1.0,199.6],[2.0,205.05],[3.0,283.6],[4.0,220.15],[5.0,313.05]];

shail raj
  • 23
  • 1
  • 2

1 Answers1

1

Here's a client side solution for generating PDF files using JavaScript only.

Code:

var data = [[1.0,199.6],[2.0,205.05],[3.0,283.6],[4.0,220.15],[5.0,313.05]];
var doc = new jsPDF();

doc.setFontSize(40);
doc.text(35, 25, data.map(function(e){ return e.join("\t"); }).join("\n"));
Vikram Deshmukh
  • 12,304
  • 4
  • 36
  • 38