How to read epub files using javascript
Asked Answered
J

2

11

How to read epub files using javascript?

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

Jefferson answered 5/6, 2013 at 6:34 Comment(1)
Did you tried github.com/augustl/js-epubProgressionist
S
18

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

Sebastien answered 5/6, 2013 at 22:25 Comment(1)
The Github Redium link changed so best to go to github.com/readium for information on that project.Stulin
O
3

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


Osullivan answered 2/11, 2019 at 10:56 Comment(3)
Judging by the nicknames it seems you are related to the author of the fork, you just forgot to mention it, correct?Tittletattle
Yes our company forked it from the main repo and improved to to reach this level does it need to mention that I involved in developing this ? I really do not knowOsullivan
Simply put, you should do it to provide fair information -- there is a difference between "I use this great lib" and "I wrote this great lib".Tittletattle

© 2022 - 2024 — McMap. All rights reserved.