js.doc的doc.save()引发错误 [英] doc.save() throwing error with jspdf
本文介绍了js.doc的doc.save()引发错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当我尝试对jsPDF使用save()函数时,会引发以下错误:
When I try and use the save() function for jsPDF it's throwing the following error:
ReferenceError:未定义saveAs
ReferenceError: saveAs is not defined
我只是尝试一个非常简单的示例:
I'm just trying a very simple example:
var doc = new jsPDF();
doc.text(20, 20, 'Hello world!');
doc.text(20, 30, 'This is client-side Javascript, pumping out a PDF.');
doc.addPage();
doc.text(20, 20, 'Do you like that?');
doc.save('test.pdf');
任何人都有什么问题吗?
Anyone have any ideas what's wrong?
推荐答案
找出问题所在. saveAs函数是 FileSaver.js 的一部分,因此我只需要包含此内容,一切便可以正常进行.
Found out what the issue was. The saveAs function is part of FileSaver.js so I just needed to include this and everything worked.
这篇关于js.doc的doc.save()引发错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文