NativeScript plugin to open and read ePub files natively.
npm install nativescript-epub-reader
- For iOS Place your
epub
files in yourApp_Resources/iOS
directory. - For Android, required absolute file path as parameter.
- Import
EpubReader
in your page and open the file.
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
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>
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');
}
}
}
- https://github.com/FolioReader/FolioReaderKit
- https://github.com/FolioReader/FolioReader-Android
Apache License Version 2.0, January 2004