How to programmatically convert HTML to epub? [closed]

The short answer is yes, it can be done in any programming language.

Basic steps:

  1. Convert your HTML to XHTML (+ CSS). This can be done in your program or through an XSLT file.
  2. Copy your files (XHTML, CSS, any images and fonts) into a directory structure that follows the format.
  3. Zip the directory structure up and name the archive with a “.epub” extension.

Some web sites to help you get started:

  • A good tutorial for what’s in an epub file (and how to create one yourself) can be found here: http://www.jedisaber.com/eBooks/Introduction.shtml. I used this to get started myself.
  • Specs for the .epub standard are here: http://www.idpf.org/
  • A validator for .epubs can be downloaded from here: https://github.com/IDPF/epubcheck

June 2015 Note: The epubcheck validator has moved from google code to GitHub; note the new URL.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)