最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - jsPDF Output PDF Download - Stack Overflow

programmeradmin0浏览0评论

I'm creating a PDF using jsPDF (). It's very basic, but suffices to do the job. To actually create the before defined PDF I use doc.output ('datauri');.

The Doc's are very poor, I don't know what output types are available and if it matters. It's very hard to find anything about this on Google; jsPDF seems to be not so mon as is should be. It opens the PDF but I want the PDF to start downloading as a file. I want this dialog to open, that ask if I want to save or open. I hope anyone understands what I'm trying to do.

I found a list of all outputtypes: What I want is:

doc.output ('save', 'filename.pdf');

But it throws an error: "Error in function jsPDF/output: saveAs is not defined" How to fix this?

I'm creating a PDF using jsPDF (https://github./MrRio/jsPDF). It's very basic, but suffices to do the job. To actually create the before defined PDF I use doc.output ('datauri');.

The Doc's are very poor, I don't know what output types are available and if it matters. It's very hard to find anything about this on Google; jsPDF seems to be not so mon as is should be. It opens the PDF but I want the PDF to start downloading as a file. I want this dialog to open, that ask if I want to save or open. I hope anyone understands what I'm trying to do.

I found a list of all outputtypes: https://stackoverflow./a/18098815/3123142 What I want is:

doc.output ('save', 'filename.pdf');

But it throws an error: "Error in function jsPDF/output: saveAs is not defined" How to fix this?

Share Improve this question edited Jul 1, 2020 at 3:01 Donald Duck is with Ukraine 8,91223 gold badges79 silver badges102 bronze badges asked Oct 3, 2014 at 15:22 ueenueen 6923 gold badges9 silver badges22 bronze badges 1
  • Possible duplicate of doc.save() throwing error with jspdf – Drew Noakes Commented May 29, 2016 at 19:33
Add a ment  | 

1 Answer 1

Reset to default 5

Fixed it my own: In my zip of jsPDF wans't a working FileSaver.js so i downloaded it again from github https://github./eligrey/FileSaver.js and linked it in the head, now everything works just fine.

发布评论

评论列表(0)

  1. 暂无评论