How to read epub files using javascript
Readium Foundation just released Readium Web Components: see http://readium.org/news/announcing-readiumjs-a-javascript-library-for-browser-based-epub-3-reading (code: https://github.com/readium/Readium-Web-Components )
Alternatively, you might want to have a look at FuturePress: http://www.futurepress.org/ (code: https://github.com/fchasen/epub.js/ )
Finally, TEA also has something you might find interesting: https://github.com/TEA-ebook/teabook-open-reader
Quite old question, TreineticEpubReader
is a popular fork of readium-js-viewer
authored by me, it provides a very simple api to interact with epub files,
https://github.com/Treinetic/TreineticEpubReader
Library is pure javascript so you can blend and mix with any modern framework, here is a sample code, you can also look at the sample
folder inside the dist
to find a working demo
<div id="epub-reader-frame"></div>
var exControls = TreineticEpubReader.handler();
exControls.registerEvent("onEpubLoadSuccess", function () {
});
exControls.registerEvent("onEpubLoadFail", function () {
});
exControls.registerEvent("onTOCLoaded", function (hasTOC) {
if (!hasTOC) {
let toc = exControls.getTOCJson();
}
// you can use following api calls after this
/**
exControls.hasNextPage()
exControls.nextPage();
exControls.hasPrevPage()
exControls.prevPage();
exControls.makeBookMark();
exControls.changeFontSize(int);
exControls.changeColumnMaxWidth(int);
exControls.setTheme("theme-id-goes-here");
exControls.setScrollMode("scroll-type-id-goes-here");
exControls.setDisplayFormat("display-format-id-goes-here");
extcontrols.getRecommendedFontSizeRange()
extcontrols.getRecommendedColumnWidthRange()
var list = extcontrols.getAvailableThemes();
var list = extcontrols.getAvailableScrollModes();
var list = extcontrols.getAvailableDisplayFormats();
var settings = extcontrols.getCurrentReaderSettings();
**/
});
var config = TreineticEpubReader.config();
config.jsLibRoot = "src/ZIPJS/";
TreineticEpubReader.create("#epub-reader-frame");
TreineticEpubReader.open("assets/epub/epub_1.epub");