React ag-grid export to pdf and print

Viewed 204

What is the best way to export ag-grid with its styles into pdf and print. I tried jsPDF but the export only take first 5 record and that too not formatted well below is the method I tried.

 const input = document.getElementById('reportGridRef');
 html2canvas(input).then((canvas) => {
      var imgData = canvas.toDataURL('image/jpeg', 1.0);
      var pdf = new jspdf("l", "mm", "a4");
      pdf.addImage(imgData, 'JPEG', 10, 10, 180, 150);  // 180x150 mm @ (10,10)mm
      pdf.output('dataurlnewwindow');
      pdf.save("download.pdf");
    });
0 Answers
Related