How to read epub files using javascript

后端 未结 2 1747
我在风中等你
我在风中等你 2020-12-31 21:55

How to read epub files using javascript?

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

相关标签:
2条回答
  • 2020-12-31 22: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

    0 讨论(0)
  • 2020-12-31 22:20

    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");
    
    
    
    0 讨论(0)
提交回复
热议问题