0

I have to load epub from internal storage device in ionic4. I have wasted my time not get any solution.

When I load epub from assets, its load properly, but when i am loading epub from ineternal storage device, can't load without error. Plz give me solution.

   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();  

its can't displays

Nitin Karale
  • 789
  • 3
  • 12
  • 34

1 Answers1

0

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 => { });
Darshana
  • 662
  • 1
  • 10
  • 29