Phonegap - Open / Copy a PDF file into iBook
Asked Answered
V

1

8

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

Vidovik answered 6/2, 2015 at 11:13 Comment(1)
It would have been great if people would have commented as well, after down-voting the question. Down-voting without commenting gives an impression that you are just down-voting questions randomly - even without reading it.If it was too technical for you to understand - there is always scope of 'comment' - which is just below Question section.Vidovik
I
3

Try with this plugin

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

It's like the one you linked but updated

Italian answered 6/2, 2015 at 12:21 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.