Search code examples
phpjqueryepub

Advanced ePub reader


I'm trying to build an advanced ePub reader using jQuery and PHP/Zend Framework1.12 (for the epub3.0 format). The reader should contain the following features:

  • books should be displayed using pages (2 pages at a time)
  • the user should be able to navigate between pages and chapters using a slider
  • the user can create highlights and bookmark pages
  • the reader must be cross-browser (I don't care much about older versions of IE, but it must work on Safari, Mozilla, Chrome)

My idea is to make some kind of PHP parser that will handle the epub content and pass it on to the Javascript code in a more 'friendly' format, but I haven't worked with epubs before and I'm not sure where to start.

Here are a few questions that I have been struggling with:

  1. The first problem I have encountered is how to extract the content from an .ePub archive and render it in a such a way that will allow the paginated view. What PHP library would you recommend for parsing epubs? I have already tested some libraries like BookGluttonEpub (seems quite old) and EPUBParser (difficult to understand since there are no examples and docs). Are there others I missed?

  2. Should I clean the html code (like remove invalid tags for example) before passing it to the reader?

  3. What do you consider is the best way to display the pages? Should I use CSS and the 'column' property? Or should I make a more advanced script that will split the html content of a chapter into pages?

Thanks


Solution

  • First extract the .epub file, its same like your zip file so you can use PHP unzip library and dont need to parse HTML or CSS. You can create your reader using HTML5 canvas and CSS 3 properties.

    I think better option is to use HTML5 and CSS3 if you are not thinking IE compatibility.