Reputation: 799
I have to load epub from internal storage device in ionic4.
When I load epub from assets, its load properly, but when i am loading epub from internal storage device, can't load without error.
this.book = ePub("assets/temp1.epub");
this.rendition = this.book.renderTo("area", {
spread: "always"
});
this.rendition.display();
its displays properly
const path = this.file.externalRootDirectory + 'ePub/temp1.epub';
this.book = await ePub(path);
this.rendition = this.book.renderTo("area", {
spread: "always"
});
this.rendition.display();
it can't display
Upvotes: 0
Views: 105
Reputation: 650
You can get this using sdcard file as ArrayBuffer as parameter of ePub()
this.file.readAsArrayBuffer(this.file.externalRootDirectory + '/appname/'+ '/', filename).then(arrayBuffer => {
var book = ePub(arrayBuffer);
var rendition = book.renderTo("area", { method: "default", width: "100%", height: "100%" });
}).catch(err => { });
Upvotes: 0