I found no easy way to make a decent-looking ePub, the standard ebook format, from my book (sadly) composed in OpenOffice.org Writer. Seeing an excuse to stop writing passive prose, to write living code, I sketched a script that makes an ePub from the HTML that Writer exports:
Example: python ebookmaker.py mybook.html
This produces mybook-clean.xhtml -- clean simple HTML of your book that you can paste into your blog or wherever -- and a mybook.epub containing resized images.
The script starts with a table of options to personalize. Those options probably don't yet offer enough control to make the script work perfectly with other books, depending on how the formatting differs from mine, but if you know a little Python and regular expressions, you can adjust the rest.
Do you know a better tool? I tried a few other converters, such as Stanza, but the results were hideous.
Let me know if you use this. It wasn't much fun to write. ePub uses XHTML, which is XML, which, if you can imagine, is the kind of formal language that a herd of UN lawyers would design.
Now that I have my ePub version, do you know any popular sites to share it on?


Have you tried eScape?
http://www.infogridpacific.com/igp/AZARDI/eScape%20-ODT2ePub/
It's an OpenOffice template. There is a tutorial at the above link.
Posted by: Carsten Peters | 01/24/2010 at 01:26 AM
Using this script on iMac Snow Leopard and NeoOffice
I got a warning:
Warning: Couldn't shrink images because I don't have the PIL Python imaging library
I tried to follow the steps that are described here
http://www.p16blog.com/p16/2008/05/appengine-installing-pil-on-os-x-1053.html
without luck
Posted by: Carsten Peters | 01/24/2010 at 01:52 AM
I noticed eScape though didn't try it. It looked like I'd have to fork off a copy of my book, paste into their template, then mark all the chapter headings with their styles. What I wanted was something, once setup, that would be completely automatic because I often update the book. Do you know if eScape does that?
Eventually I might just switch the primary representation of the book to DocBook since there seems to be a nice set of tools for automating production of ePub, HTML, PDF, etc. from it.
On the problem installing PIL, I haven't owned a Mac for a couple years, so I can't give definite instructions. http://effbot.org/media/downloads/PIL-1.1.7a2-py2.5-macosx10.5.mpkg.zip might work. Or just get the source version from http://effbot.org/downloads/Imaging-1.1.7.tar.gz and compile it yourself: 'tar xzf Imaging-1.1.7.tar.gz' in the directory that you downloaded to, then follow the instructions file in the new subdirectory.
Posted by: Patrick Roberts | 01/25/2010 at 09:42 PM
yeah its becomes easier with your standard ebook format..thanks
Posted by: vimax | 04/21/2010 at 05:19 AM
I can offer you the ODFToEPub OpenOffice extension. It doesn't impose any style. It just translates the style information in your document and it's easy to use.
http://www.pincette.biz/odftoepub/
Werner Donné
Pincette bvba
Posted by: Werner Donné | 04/24/2010 at 07:26 AM
This might be of interest:
writer2epub
http://www.mobileread.com/forums/showthread.php?t=69636
Posted by: John Hardin | 06/30/2010 at 06:28 PM
Would you mind to elaborate on why you are sad about the fact you were using openoffice for this purpose?
Posted by: Boris | 01/09/2011 at 07:35 AM