All Projects → futurepress → Epub.js

futurepress / Epub.js

Licence: other
Enhanced eBooks in the browser.

Programming Languages

javascript
184084 projects - #8 most used programming language

Labels

Projects that are alternatives of or similar to Epub.js

bookr-mod-vita
A book reader for the Vita and Switch. Still a work in progress.
Stars: ✭ 51 (-98.9%)
Mutual labels:  epub
Ruby Hacking Guide.github.com
Ruby Hacking Guide Translation
Stars: ✭ 305 (-93.41%)
Mutual labels:  epub
Readium Sdk
A C++ ePub renderer SDK
Stars: ✭ 351 (-92.42%)
Mutual labels:  epub
Duareader
电子书阅读器,支持txt,e-pub(图文混排),纯swift编写,支持OC混编。 An e-book reader that supports TXT and e-pub formats. This project is written in swift and supports hybrid compilation with objective OC
Stars: ✭ 258 (-94.43%)
Mutual labels:  epub
Readium Js
EPUB processing engine written in Javascript
Stars: ✭ 287 (-93.8%)
Mutual labels:  epub
Thorium Reader
A cross platform desktop reading app, based on the Readium Desktop toolkit
Stars: ✭ 319 (-93.11%)
Mutual labels:  epub
fiction-dl
A content downloader, capable of retrieving works of (fan)fiction from the web and saving them in a few common file formats.
Stars: ✭ 22 (-99.52%)
Mutual labels:  epub
Crowbook
Converts books written in Markdown to HTML, LaTeX/PDF and EPUB
Stars: ✭ 399 (-91.38%)
Mutual labels:  epub
Redux Offline Docs
Redux documentation in PDF, ePub and MOBI formats for offline reading.
Stars: ✭ 292 (-93.69%)
Mutual labels:  epub
Lightnovel Crawler
Download and generate e-books from online sources.
Stars: ✭ 344 (-92.57%)
Mutual labels:  epub
Narou
Narou.rb - 小説家になろうのダウンローダ&縦書き整形&管理アプリ。Kindle(などの電子書籍端末)でなろうを読む場合に超便利です!
Stars: ✭ 256 (-94.47%)
Mutual labels:  epub
Starter Book
A book starter to kickstart your writing journey 🎉
Stars: ✭ 277 (-94.02%)
Mutual labels:  epub
Percollate
A command-line tool to turn web pages into beautiful, readable PDF, EPUB, or HTML docs.
Stars: ✭ 3,535 (-23.63%)
Mutual labels:  epub
lightnovel epub
🍭 epub generator for (light)novels (轻) 小说 epub 生成器,支持站点:轻之国度、轻小说文库
Stars: ✭ 89 (-98.08%)
Mutual labels:  epub
Fanficfare
FanFicFare is a tool for making eBooks from stories on fanfiction and other web sites.
Stars: ✭ 359 (-92.24%)
Mutual labels:  epub
cheepub
PDF/EPUB generator from Markdown
Stars: ✭ 17 (-99.63%)
Mutual labels:  epub
Unix As Ide
The ebook version of Tom Ryder's series on the Unix programming environment
Stars: ✭ 315 (-93.2%)
Mutual labels:  epub
Readium Js Viewer
👁 ReadiumJS viewer: default web app for Readium.js library
Stars: ✭ 438 (-90.54%)
Mutual labels:  epub
Epub Press Clients
📦 Clients for building books with EpubPress.
Stars: ✭ 370 (-92.01%)
Mutual labels:  epub
Vivliostyle.js
📖 The power of CSS typesetting, right at your fingertips.
Stars: ✭ 328 (-92.91%)
Mutual labels:  epub

Epub.js v0.3

FuturePress Views

Epub.js is a JavaScript library for rendering ePub documents in the browser, across many devices.

Epub.js provides an interface for common ebook functions (such as rendering, persistence and pagination) without the need to develop a dedicated application or plugin. Importantly, it has an incredibly permissive Free BSD license.

Try it while reading Moby Dick

Why EPUB

Why EPUB

The EPUB standard is a widely used and easily convertible format. Many books are currently in this format, and it is convertible to many other formats (such as PDF, Mobi and iBooks).

An unzipped EPUB3 is a collection of HTML5 files, CSS, images and other media – just like any other website. However, it enforces a schema of book components, which allows us to render a book and its parts based on a controlled vocabulary.

More specifically, the EPUB schema standardizes the table of contents, provides a manifest that enables the caching of the entire book, and separates the storage of the content from how it’s displayed.

Getting Started

Get the minified code from the build folder:

<script src="../dist/epub.min.js"></script>

If using archived .epub files include JSZip:

<script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.1.5/jszip.min.js"></script>

Set up a element to render to:

<div id="area"></div>

Create the new ePub, and then render it to that element:

<script>
  var book = ePub("url/to/book/package.opf");
  var rendition = book.renderTo("area", {width: 600, height: 400});
  var displayed = rendition.display();
</script>

Render Methods

Default

book.renderTo("area", { method: "default", width: "100%", height: "100%" });

View example

The default manager only displays a single section at a time.

Continuous

book.renderTo("area", { method: "continuous", width: "100%", height: "100%" });

View example

The continuous manager will display as many sections as need to fill the screen, and preload the next section offscreen. This enables seamless swiping / scrolling between pages on mobile and desktop, but is less performant than the default method.

Flow Overrides

Auto (Default)

book.renderTo("area", { flow: "auto", width: "900", height: "600" });

Flow will be based on the settings in the OPF, defaults to paginated.

Paginated

book.renderTo("area", { flow: "paginated", width: "900", height: "600" });

View example

Scrolled: book.renderTo("area", { flow: "scrolled-doc" });

View example

Scripted Content

Scripted content, JavasScript the ePub HTML content, is disabled by default due to the potential for executing malicious content.

This is done by sandboxing the iframe the content is rendered into, though it is still recommened to santize the ePub content server-side as well.

If a trusted ePub contains interactivity, it can be enabled by passing allowScriptedContent: true to the Rendition settings.

<script>
  var rendition = book.renderTo("area", {
    width: 600,
    height: 400,
    allowScriptedContent: true
  });
</script>

This will allow the sandboxed content to run scripts, but currently makes the sandbox insecure.

Documentation

API documentation is available at epubjs.org/documentation/0.3/

A Markdown version is included in the repo at documentation/API.md

Running Locally

install node.js

Then install the project dependences with npm

npm install

You can run the reader locally with the command

npm start

Examples

View All Examples

Testing

Test can be run by Karma from NPM

npm test

Building for Distribution

Builds are concatenated and minified using webpack and babel

To generate a new build run

npm run prepare

or to continuously build run

npm run watch

Hooks

Similar to a plugins, Epub.js implements events that can be "hooked" into. Thus you can interact with and manipulate the contents of the book.

Examples of this functionality is loading videos from YouTube links before displaying a chapter's contents or implementing annotation.

Hooks require an event to register to and a can return a promise to block until they are finished.

Example hook:

rendition.hooks.content.register(function(contents, view) {

    var elements = contents.document.querySelectorAll('[video]');
    var items = Array.prototype.slice.call(elements);

    items.forEach(function(item){
      // do something with the video item
    });

})

The parts of the rendering process that can be hooked into are below.

book.spine.hooks.serialize // Section is being converted to text
book.spine.hooks.content // Section has been loaded and parsed
rendition.hooks.render // Section is rendered to the screen
rendition.hooks.content // Section contents have been loaded
rendition.hooks.unloaded // Section contents are being unloaded

Reader

The reader has moved to its own repo at: https://github.com/futurepress/epubjs-reader/

Additional Resources

Gitter Chat

Epub.js Developer Mailing List

IRC Server: freenode.net Channel: #epub.js

Follow us on twitter: @Epubjs

Other

EPUB is a registered trademark of the IDPF.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].