How to programmatically convert HTML to epub?

Juanjo Conti picture Juanjo Conti · Aug 11, 2010 · Viewed 44.6k times · Source

Can I do this conversion with any programming language or library?

Answer

eb1 picture eb1 · Dec 10, 2010

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:

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