after executing the below function getting error In function, simple HTML div tags are inserted but still not working
exportPDF function will call when one button will click to generate pdf
Function
const exportPDF = () => {
let element=(<div style={{display: "flex",flexWrap:"wrap"}}>Sample Text</div>)
const doc = new jsPDF();
doc.html(element, {
callback: function (doc) {
doc.save('sample.pdf');
}
});
}
Error
jspdf.es.min.js:128 Uncaught (in promise) Error: Unknown source type.
at Promise.<anonymous> (jspdf.es.min.js:128:1)
I'm using npm package of jsPDF ("jspdf": "^2.4.0")
Unable to figure out why doc.html not working in this code