Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Phonegap - Open / Copy a PDF file into iBook

I am generating a PDF file using jsPdf Lib inside a Phonegap iOS application. PDF is generated and I am able to see it inside InAppBrowser, just after creation.

I would like to store it at a place, where user would access it from outside of app as well. In android, that's not an issue. In iOS, is it possible to open the generated file in iBook, Or, copy the pdf in iBook? I have read somewhere that using 'itms-books:' it is possible. Can anyone suggest something please?

In general, when I open any pdf in safari, it gives me an option for 'Show/Add in iBook' - which adds the pdf in iBook. But Safari can not open any pdf file, which is stored inside app's documents area. So when I try window.open() with filesystem url and _system parameter, nothing happens. However, when I use window.open() with filesystem url and _blank parameter, it opens that pdf in InAppBrowser. But, there is no option for 'Show/Add in iBook'.

So, what is the best way to proceed? The goal is that user can access the PDF (generated using app), without opening the app later.

Resources checked already:

https://stackoverflow.com/questions/23656211/how-to-save-downloaded-pdf-in-ibooks-using-phonegap - No proper answer

Send PDF to iBooks - For Native, not for Phonegap

http://www.tricedesigns.com/2014/01/08/generating-pdf-inside-of-phonegap-apps/ - Concentrates mainly on creation of the pdf, not on opening

http://www.tricedesigns.com/2012/08/15/open-with-in-ios-phonegap-apps/ - Provides following link

https://github.com/triceam/phonegap-plugins/tree/master/iOS/ExternalFileUtil - For older version of Phonegap

https://github.com/don/FileOpener - Not for iOS

like image 690
Prasoon Avatar asked Feb 06 '15 11:02

Prasoon


1 Answers

Try with this plugin

https://github.com/pwlin/cordova-plugin-file-opener2

It's like the one you linked but updated

like image 135
jcesarmobile Avatar answered Oct 19 '22 23:10

jcesarmobile