简体   繁体   中英

jsPDF Output PDF Download

I'm creating a PDF using jsPDF ( https://github.com/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 common 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.com/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?

我自己修复了它:在我的 jsPDF zip 中没有可用的 FileSaver.js 所以我从 github https://github.com/eligrey/FileSaver.js再次下载它并将它链接到头部,现在一切正常.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM