Cordova/Phonegap eBook reader for Web and Mobile with Epub.js plugin
In this post I’ll present you the Epub.js plugin.
With this plugin, you are able to create ebook readers for web, nodejs and mobile apps using Phonegap and Cordova. I’m working in a epub reader for Android with Cordova, and this lib is perfect, so, if you need anything like this, you really must to try it.
Tutorial - How to use Epub.js
Let’s start. Download Epub.js here, take a look in their documentation, but It’s so simple, everything that you need is here.
Add the Epub.js to your source:
Now, create the next and prev buttons:
You can create your css and customize these divs as you prefer.
Your book will be rendered inside a div, so create it:
And finally, you just need to render the book inside the div. So, run the script:
It’s done!! As you can see, this plugin is completely simple and useful. With theses commands, you are able to create a powerful reader.
How to use Epub.js with Cordova / Phonegap
If you are going to work with mobile devices, you can use the same code above, but some Android devices can present some bugs. To fix it, add the same script:
With this script, Epub.js runs on Android, with no problems.
Thanks for reading, take a look in the blog to find more tutorials. If you need to ask something, just comment here!!