'jsPDF package is downloading as an empty PDF for html content in react (typescript)
I am using jsPDF to download HTML content as pdf in react. I can download a pdf file, but it is showing an empty page only. If I use text for download like this
const doc = new jsPDF("p", "pt", "a4", true);
doc.text("hello", 10, 20);
doc.save();
it is downloading with the content "hello". But I use html to download,
const doc = new jsPDF("p", "pt", "a4", true);
var elem: any = document.getElementById("test");
doc.html(elem, {
callback: (doc: any) => {
doc.save(`Test.pdf`);
}
});
It is downloading as an empty page only. Since the tag changed to fromHTML to html, I need help on this. (previous discussions are a long time ago happened).
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
