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]];
Asked
Active
Viewed 3,893 times
0
-
Use jsPDF. Check this answer http://stackoverflow.com/questions/16858954/how-to-properly-use-jspdf-library – Anurag Verma Oct 05 '15 at 06:47
1 Answers
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