This turns an epub into a very rudimentary Android app.
More specifically, it copies and adapts an epub's content into the content of very basic Apache Cordova project, which you can then adapt and build into an app for any platform that Cordova supports.
- Currently, Windows (to use the
run.bat
script, alternatively see Manual usage below) - Node.js
- Android Studio
- Apache Cordova
- Install the Node dependencies with
npm install
. - Edit the templates in
_templates
if necessary. - Edit the values in
config.xml
. - Put an epub in
_source
. - Run
run.bat
and follow the prompts, completing each step in order.
The run.bat
script for Windows (the last step above) simply manages the following steps, which you could also do manually:
- Unzip the epub's contents to the
www
folder. (That is, themimetype
file should end up inwww
.) - In the root directory, run
node appify.js --epub _source/yourepub.epub
, whereyourepub.epub
is the filename of your epub in_source
. - In the root directory, run
cordova build
. (Sometimes you need to runcordova platform rm android && cordova platform add android
first.) - In the root directory, run
cordova run --emulator
. (Assuming you have Android Studio already set up with a default emulator.)
- Keep text in one directory. Currently, the book-content files in the source epub must be in the same directory. That is, don't structure your epub so that some content is in subdirectories in the epub package. This is because we automatically insert a relative link to the nav file, and this link assumes that the nav file is in the same directory as the book text.
- List all content in the nav. The only way for a user to access a content document is to find it in the navigation. There is no other way to move through the book at this point (there is no pagination, for instance).
- Use EPUB3. This won't work on EPUB2 epubs, largely because it looks for a
nav
element, which is an EPUB3 thing.