Reputation: 633
Using jsPDF in angular 2, I am running this code on a button click:
generatePDF(){
const options = {'pagesplit': true}
this.pdf.addHTML(this.id.nativeElement, 10, 10, options, function(){
this.pdf.save('test.pdf')
});
}
onClick the generatePDF function is called and throws this error without generating the pdf: html2canvas: onrendered option is deprecated, html2canvas returns a Promise with the canvas as the value I have checked the official documentation of jsPDF, it does say it is deprecated.
I would appreciate some help on this. Thanks!
Upvotes: 1
Views: 922
Reputation: 160
jsPDF need to be updated to match HTML2Canvas library, they removed the onrendered callback and changed it to use Promise, use an old version of HTML2Canvas "0.5.0-beta4" or less and it will work.
Edit: new library called html2pdf is out, check it
Upvotes: 1