I am stuck in jsPDF package. i want to print html to pdf.
const toPdf = () => {
let doc = new jsPDF("p", "px", "a4");
doc.html(document.querySelector("#printdiv"), {
callback: function (pdf) {
pdf.save("preview.pdf");
},
});
};
<button onClick={toPdf()}></button>
it is a simple to print html in pdf but the problem is that when i want to print another html in callback so i did not get any response from this. no page created and no any html print on page.