Tags

, ,

Since we announced the Document Liberation Project and its accompanying framework library, librevenge, there has been several requests for EPUB generator. (librevenge itself contains generators to CVS, HTML, SVG and plain text. There is also a separate library for generating ODF called libodfgen.) I had an idle moment two weeks ago and did not feel like working on any of my existing projects, so I decided to look at this. I started a new library, libepubgen (predictable, eh?) The core of it was the HTML generation code from librevenge, modified to produce its output to an abstract output interface instead of into librevenge::RVNGString and also to create XHTML 1.0 instead of HTML 4.01.

Since then, in more idle moments, I added support for images and simple splitting of the HTML output to multiple files. I also integrated the new library into writerperfect, so there are now command line tools to convert various text formats supported by writerperfect to EPUB (for every foo2odt, there is now foo2epub as well). What is still missing is handling of foreign binary objects, the drawing parts of librevenge::RVNGTextInterface (I think I will convert these to SVG images), smarter splitting of HTML files (provided there is enough information from the input) and probably more things I cannot think of right now. It would also be nice to allow conversion of presentations (in other words, to implement librevenge::RVNGPresentationInterface), as they tend to contain lots of text.

The interface is probably not going to change much at this point (except adding functions for registering binary object handlers and possibly some configuration to libepubgen::EPUBTextGenerator). One thing to highlight is that, like libodfgen, libepubgen does not create the output file directly. Instead, it provides an interface (libepubgen::EPUBPackage), which the caller has to implement. All internal files are then generated using this interface. The only exception is mimetype, which must always be created by the caller (only if it creates Zip container, of course. mimetype is not needed for filesystem container).

I will continue to work (on and off) on this, but I have no estimate when the first release is going to happen. If anyone is interested and wants to help, patches are welcome. Bug reports too, but remember this is a new project, so bugs are expected.