1.0.0 • Published 5 years ago

nativescript-epub-reader v1.0.0

Weekly downloads
-
License
Apache-2.0
Repository
-
Last release
5 years ago

nativescript-epub-reader

NativeScript plugin to open and read ePub files natively.

Getting Started

  • npm install nativescript-epub-reader
  • For iOS Place your epub files in your App_Resources/iOS directory.
  • For Android, required absolute file path as parameter.
  • Import EpubReader in your page and open the file.

Android Permissions Required

<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />

AndroidManifest

Starting with Android 9.0 (API level 28), cleartext support is disabled by default.

{your-app-module}/res/xml/network_security_config.xml

<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
    <domain-config cleartextTrafficPermitted="true">
        <domain includeSubdomains="true">127.0.0.1</domain>
        <domain includeSubdomains="true">localhost</domain>
    </domain-config>
</network-security-config>

Then add network_security_config.xml in your app module's AndroidManifest.xml

<?xml version="1.0" encoding="utf-8"?>
<manifest ...>
    ...
    <application android:networkSecurityConfig="@xml/network_security_config">
    ...
    </application>
</manifest>

Code Sample

import {Observable} from 'data/observable';
import { EpubReader } from 'nativescript-epub-reader';
import * as application from "tns-core-modules/application";

export class HelloWorldModel extends Observable {

  constructor() {
    super();
    let ePubReader = new EpubReader();
    if (application.android) {
        ePubReader.open('/storage/emulated/0/Download/Metamorphosis-jackson.epub');
    }else{
        ePubReader.open('book');
    }
  }

}

IOS Demo

Image

Android Demo

Custom Fonts

Custom fonts

Day and Night Mode

Day night mode

Text Highlighting

Highlight

Media Overlays

Media Overlay

Credits

License

Apache License Version 2.0, January 2004