I have a bunch of intertwingled HTML web pages that I want to convert to EPUB format.

For instance the index page is at


While the chapters linked from the index pages are in


Also some images and formatting files are in


Is there a tool to download and convert recursively the documentation, passing those specific constraints, into epub format?

I can download the pages with httrack like so:

httrack http://example.com/documentation/index/index.html +http://example.com/documentation/index/* +http://example.com/documentation/chapters/* +http://example.com/css/* +http://example.com/img/*

… and convert the HTML pages to XHTML using tidy-html5

tidy -asxhtml -numeric < index.html > index.xhml

but I still haven’t found a tool to convert the entire tree into EPUB at once.

Also, tried Calibre once but the UI is unfriendly, so I really didn’t try to get a grasp of that tool. If I have to learn the Calibre UI, I rather prefer to write a bash script to do the job.

  • Calibre has a command-line interface as well. I rarely use the GUI at all. See here for parameters to the ebook-convert CLI. And yes, in my case it's usually a Bash script doing the job: I use a skeleton with "placeholders" (variables) for source details :)
    – Izzy
    Mar 25, 2016 at 10:02

1 Answer 1


While not always giving perfect results you can use pandoc to download html from the web and generate an epub all in one go - you may need to tell pandoc the order of the pages/chapters and/or which pages but any referenced css/images should also be downloaded and embedded automatically.

  • Command Line - Yes
  • Does the downloads direct from the web - Yes
  • Create e-pub - Yes and lots of others
  • Free, gratis & open source
  • Cross Platform including OS-X

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.