Currently, I am working with Angular and I have a requirement to convert an HTML table into a PDF format. Below is the code snippet from my component.ts file:
downloadPDF() {
const doc = new jsPDF();
const specialElememtHandlers = {
'#editor'(element, renderer) {
return true;
}
};
doc.fromHTML(this.content.nativeElement.innerHTML, 15, 15, {
width: 190,
elementHandlers: specialElememtHandlers
});
doc.save('test.pdf');
}
Here is my corresponding HTML code:
<button (click)="downloadPDF()">Save as PDF</button>
Although I can successfully download a PDF file, unfortunately, it appears completely white.