react-book-reader
v1.1.6
Published
<div align="center"> <img width=250 src="https://raw.githubusercontent.com/jinhuan138/react-book-reader/master/docs/public/logo.png" /> <h1>ReactBookReader</h1> </div>
Downloads
712
Maintainers
Readme
Introduction
react-book-reader is a react wrapper for foliate-js - library for rendering e-books in the browser. Supports EPUB, MOBI, KF8 (AZW3), FB2, CBZ, PDF (experimental; requires PDF.js), or add support for other formats yourself by implementing the book interface
Basic usage
npm install react-book-reader --saveAnd in your react-component...
import { ReactReader } from 'react-book-reader'
export default () => (
<div style={{ height: '100vh' }}>
{/* Supports EPUB, MOBI, KF8 (AZW3), FB2, CBZ, PDF */}
<ReactReader url="/files/啼笑因缘.epub" />
</div>
);ReactReader Attributes
| Name | Description | Type | Default |
| -------- | --------------------------------- | ---------------------- | ----------- |
| url | book url or File | string/File | — |
| location | set / update location of the book | string/number | — |
| title | the title of the book | string | — |
| showToc | whether to show the toc | boolean | true |
ReactReader props passed to inner BookView
| Name | Description | Type | Default |
| ----------- | ----------------------------------------- | --------------------------------- | ---------------- |
| url | book url or File | string/File | |
| tocChanged | when the reader has parsed the book you will receive an array of the chapters | function(toc) |
| nextPage | display next page | function |
| prevPage | display previous page | function |
| setLocation | Set the page | function(href) |
| LoadingView | if you want to customize the LoadingView | element |
| ErrorView | if you want to customize the ErrorView | element |
