Coder Social home page Coder Social logo

mouesam / epub_viewer Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jideguru/epub_viewer

1.0 0.0 0.0 35.92 MB

An epub reader for Flutter. Wrapped around Folioreader.(WIP)

Home Page: https://pub.dev/packages/epub_viewer

License: Apache License 2.0

Java 41.03% Ruby 3.94% Swift 20.29% Objective-C 0.71% Dart 33.75% Kotlin 0.27%

epub_viewer's Introduction

Epub Viewer pub package

originally a fork of epub_kitty with few more features. i made this out of epub_kitty because the author was inactive(he isn't merging PRs or attending to issues) and i started having alot of issues with the plugin

epub_viewer is an epub ebook reader that encapsulates the folioreader framework. It supports iOS and android.

Features

Name Android iOS
Reading Time Left / Pages left
Last Read Locator
Distraction Free Reading
Load ePub from Asset

ScreenShots

                 

Install

This plugin requires Swift to work on iOS. Also, the minimum deployment target is 9.0

platform :ios, '9.0'

Import into pubspec.yaml

dependencies:
  epub_viewer: latest_version

Note: Please add this to the release build type in your app build.gradle to avoid crashes on android release builds

minifyEnabled false
shrinkResources false

Usage

EpubViewer.setConfig(
  themeColor: Theme.of(context).primaryColor,
  identifier: "iosBook",
  scrollDirection: EpubScrollDirection.VERTICAL,
  allowSharing: true,
  enableTts: true,
)

/**
* @bookPath
* @lastLocation (optional and only android)
*/
EpubViewer.open(
  'bookPath',
  lastLocation: EpubLocator.fromJson({
    "bookId": "2239",
    "href": "/OEBPS/ch06.xhtml",
    "created": 1539934158390,
    "locations": {
       "cfi": "epubcfi(/0!/4/4[simple_book]/2/2/6)"
    }
  }), // first page will open up if the value is null
);

// Get locator which you can save in your database
EpubViewer.locatorStream.listen((locator) {
   print('LOCATOR: ${EpubLocator.fromJson(jsonDecode(locator))}');
   // convert locator from string to json and save to your database to be retrieved later
});

You can also load epub from your assets using EpubViewer.openAsset()

await EpubViewer.openAsset(
  'assets/3.epub',
  lastLocation: EpubLocator.fromJson({
      "bookId": "2239",
      "href": "/OEBPS/ch06.xhtml",
      "created": 1539934158390,
      "locations": {
         "cfi": "epubcfi(/0!/4/4[simple_book]/2/2/6)"
      }
  }), // first page will open up if the value is null
 );

// Get locator which you can save in your database
EpubViewer.locatorStream.listen((locator) {
   print('LOCATOR: ${EpubLocator.fromJson(jsonDecode(locator))}');
   // convert locator from string to json and save to your database to be retrieved later
});

Check the Sample project or this ebook app for implementation

Issues

If you encounter any problems feel free to open an issue. If you feel the library is missing a feature, please raise a ticket on Github and I'll look into it. Pull request are also welcome.

For help getting started with Flutter, view the online documentation.

For help on editing plugin code, view the documentation.

epub_viewer's People

Contributors

elmissouri16 avatar imgbotapp avatar jideguru avatar jobic10 avatar mouesam avatar munjata avatar

Stargazers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.