本文介绍了在es6中使用jsPDF和html2canvas的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 我正在尝试将jsPDF和html2canvas与es6结合使用.I'm trying to use jsPDF and html2canvas with es6.我正在导入html2canvas和jsPDF,但是在addHTML上出现错误当我注释掉addHTML时,会生成pdf.I'm Importing html2canvas and jsPDF but getting an error on the addHTMLwhen I comment out the addHTML the pdf is generated.任何提示是什么问题?谢谢.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>推荐答案在index.html中包括以下脚本,而不是在打字稿文件中导入Include the following script in index.html instead of the import in typescript file <script src="https://cdnjs.cloudflare.com/ajax/libs/html2canvas/0.4.1/html2canvas.js"></script> 这篇关于在es6中使用jsPDF和html2canvas的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!