0

I am currently using epub.js to try to display epub files. I am currently reading from a file, and everything up to the epub.js part is working correctly. Here is my code:

<!doctype html>
<body>
  <button onclick=c()>Add File</button>
  <div id='book'></div>
  <script src="https://cdn.jsdelivr.net/npm/epubjs/dist/epub.min.js"></script>
<script>
  function c(){
    a=document.createElement('input');
    a.type='file';
    a.click();
    a.onchange=function(){
      printFile(this.files[0])
    }
  }
function printFile(file) {
 book = null;
 var firstFile = file;
 if (window.FileReader) {
  var reader = new FileReader();
  reader.onload = function(e) {
   book = ePub({ bookPath: e.target.result });
   book.renderTo('book');
  }.bind(this);
  reader.readAsArrayBuffer(firstFile);
 }
}
</script>
</body>

I have tried many different arguments to try to run the ePub() function, and have thus far failed to get any response. I expected it to create the first page, but it doesn't.

0 Answers0