nativescript-epub-reader
Your awesome NativeScript plugin.
npm i --save nativescript-epub-reader

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

  • https://github.com/FolioReader/FolioReaderKit
  • https://github.com/FolioReader/FolioReader-Android

License

Apache License Version 2.0, January 2004