I'm trying to use jsPDF and html2canvas with es6.
I'm Importing html2canvas and jsPDF but getting an error on the addHTML when I comment out the addHTML the pdf is generated.
any clue what is the problem?
Thanks.
jspdf.debug.js:3754Uncaught Error: You need either https://github.com/niklasvh/html2canvas or https://github.com/cburgmer/rasterizeHTML.js(…)jsPDFAPI.addHTML @ jspdf.debug.js:3754(anonymous function) @ index.js:12(anonymous function) @ bundle.js?V1.27.2:31546(anonymous function) @ bundle.js?V1.27.2:31547__webpack_require__ @ bootstrap f7845b2…:555fn @ bootstrap f7845b2…:86(anonymous function) @ bootstrap f7845b2…:578__webpack_require__ @ bootstrap f7845b2…:555(anonymous function) @ bootstrap f7845b2…:578(anonymous function) @ bootstrap f7845b2…:578
import html2canvas from 'html2canvas';
import jsPDF from 'jspdf';
doc.setFontSize(40);
doc.text(35, 25, "Paranyan loves jsPDF");
doc.addHTML(document.footer,function() {
pdf.save('web.pdf');
});
<footer>
<p id="to-pdf">HTML content...</p>
</footer>