Q:

pdf table files download react not working

let page = document.getElementById("divToPrint"); 
html2PDF(page, {
      jsPDF: { unit: "pt", format: "A4", orientation: "portrait" },
      imageType: "image/jpeg",
      output: "./pdf/generate.pdf",
    });
1
let input = document.getElementById("divToPrint"); 

html2canvas(input)
  .then((canvas) => {
    const imgData = canvas.toDataURL('image/png');
    const pdf = new jsPDF();
    pdf.addImage(imgData, 'PNG', 0, 0);
    pdf.save("download.pdf");  
  });
;
1

New to Communities?

Join the community