Reputation: 547
Im trying to open an ePub file directly inside my iOS app.
The problem is that i need the user, to save some notes.
So far i've been using the :
https://github.com/FolioReader/FolioReaderKit
Library.
Is there a way i can open iBooks inside the app?
open with UIDocumentationController
unfortunately is no an option right now.
Is there any other lib that i can do that?
Thanks
Upvotes: 1
Views: 6847
Reputation: 1676
First, there is a deprecated library, FolioReaderKit that does a very lovely work presenting different *.epub files. However, it is not maintained and is using UIWebView which will prevent from applications using it to upload to the AppStore.
[UPDATE] There are several forks 1, 2 of the above repository which have migrated to WebKit. I have not tested them nor, not how they work.
Second, the only actual out-of-the-box iOS SDK I found that gives you a full UI solution are skyepub and Adobe which are partially asking for payment.
But looking around the cod, examples, and tutorials I learned a lot...
After evading a lot I come up to the following conclusions:
EPUB is basically a zip file that incorporates within a website, usually including some index.html file with some pictures, CSS, and fonts. What is an EPUB.
To supply EPUB locally on iOS you will have to parse unzip it locally and serve the main file behind it (again we are talking bout the main use case of an html file). you can use different libraries such EPUBKit
You might need to allow access to the local files when parsing them, this might require allowing non-tls requests...
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0">
<dict>
<key>NSAllowsArbitraryLoads</key> <true/>
<key>NSExceptionDomains</key> <dict>
<key>localhost</key> <dict>
<key>NSExceptionAllowsInsecureHTTPLoads</key> <true/>
<key>NSExceptionMinimumTLSVersion</key> <string>TLSv1.2</string>
<key>NSExceptionRequiresForwardSecrecy</key> <true/>
<key>NSIncludesSubdomains</key> <true/>
<key>NSRequiresCertificateTransparency</key> <false/>
<key>NSThirdPartyExceptionAllowsInsecureHTTPLoads</key> <true/>
<key>NSThirdPartyExceptionMinimumTLSVersion</key <string>TLSv1.2</string>
<key>NSThirdPartyExceptionRequiresForwardSecrecy</key> <true/>
</dict>
</dict>
</dict>
</plist>
You might need to add custom css and js code (evaluate within the WKWebView you will use to load the html file into) to accommodate to the UI you desire to supply. A great example that helped me a lot is the Style.css and Bridge.js files and their usage in FolioReaderKit
Hopes it shed some light over EPUBs and iOS
Upvotes: 4
Reputation: 156
I don't know a library that can resolve your problem, but a solution could be
use my library https://github.com/f-meloni/epubExtractor or https://cocoapods.org/pods/KFEpubKit, to unzip the epub
use UIWebView
to render the ePub chapters
use marker.js library for words selection and highlight https://developers.google.com/maps/documentation/javascript/markers
use a database to save notes and highlights.
Upvotes: 2
Reputation: 1450
Today FolioReaderKit do not support Notes like iBooks, although it is on our roadmap. You can join the discussion on #16, the screens are already designed and there are discussions on implementation.
Regarding iBooks there is no way to use it inside your app.
Upvotes: 2