Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to read epub files using javascript

How to read epub files using javascript?

I tried epubjs but thats not suited for my requirement. Is any other alternative javascript libraries available?

like image 821
RajeshKumar.K Avatar asked Jun 05 '13 06:06

RajeshKumar.K


Video Answer


2 Answers

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

like image 159
Alberto Pettarin Avatar answered Oct 10 '22 22:10

Alberto Pettarin


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 filesenter image description here,

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");


like image 42
imal hasaranga perera Avatar answered Oct 10 '22 23:10

imal hasaranga perera