Reputation: 836
can we generate pdf using jspdf in mobile phones and tabs? I have simple android application (no Phonegap no Cordova), and an IOS application, jspdf works in web smoothly , but not able to generate pdf in IOS and Android.
doc.output('save', 'Pass.pdf');
works fine for web-browsers. I tried
doc.save();
and
var blob = pdf.output();
window.open(URL.createObjectURL(blob));
and when I tried :
var res = doc.output();
var blob = new Blob([res]);
window.open(URL.createObjectURL(blob));
I received somthing like this in the android
onLoadResource=data:application/pdf;base64,JVBERi0xLjMKMyAwIG9iago8PC9UeXBlIC9QYWdlCi9QYXJlbnQgMSAwIFIKL1Jlc291cmNlcyAyIDAgUgovTWVkaWFCb3ggWzAgMCA1OTUuMjggODQxLjg5XQovQ29udGVudHM......
but no pdf
so Now I want to know , is it even possible to generate pdf in mobiles using jspdf?or is it all in vain?
If yes , how?
Upvotes: 1
Views: 4205
Reputation: 836
IOS: Google told me that: To download PDFs to your iPad, iPhone, or iPod Touch, you'll need to download an application.
Hence it wasn't possible to do it from jspdf directly so I quit trying onto that.
Android: I din't find any solution regarding that, I moved to another solution.
Image instead of PDF (for both iPhone and Android)
The Information which you want to show in pdf, base64 that information , and send it to Android Api , which could convert it to png and save it to photo gallery.
I hope this may help somebody in future.
Upvotes: 1