ueen
ueen

Reputation: 692

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?

Upvotes: 4

Views: 13086

Answers (1)

ueen
ueen

Reputation: 692

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

Upvotes: 5

Related Questions