EPub programming

From MobileRead
Jump to: navigation, search

This page is for those programmers who want to be able to generate a program to build an ePub book. For other libraries & implementations see the Stack Overflow threads with the "epub" tag.


[edit] C# (.Net Framework)

  • DotNetEpub is a simple .NET library for ePUB files generation. What it can do:
    • Package your xhtml/css/images/fonts in one ePub file
    • Add auxiliary xhtml files (like notes)
    • Add metadata (author, title, description, ID)
    • Generate TOC with nested entries.

[edit] Perl

  • EBook::Epub is a perl module that helps you develop scripts that manipulate epub files.

[edit] Python

  • epub-tools is a collection of open source (BSD) tools for generating and managing EPUB documents, including conversions from:
    • Word
    • RTF
    • DocBook
    • TEI
    • FictionBook
  • python-epub-builder is a small python library for programmatically building EPUB books. It provides API for easily constructing and packaging EPUBs from text content.
  • ebooklib is a python library for handling books in EPUB2/EPUB3 and Kindle format

[edit] Docbook/XSLT

DocBook is a well-known dialect of XML which allows better semantics. It also has a well-maintained series of XSLT stylesheets, one of which specifically outputs epub. This Epub XSL transformation is included with Oxygen XML Editor/Author tool, but it is more common for technical writers and programmers to create a XSL file (called a "customization layer") which invokes the DocBook Epub XSL file and any customizations you need to make to the epub file.

Advantages of using DocBook for outputting epub

  • Many advanced book features are already built in (Indices, XRefs, captions, images, Table of Contents)
  • easier to edit and to version source
  • not necessary to use regex to make global changes

Disadvantages of using DocBook for outputting epub:

  • steep learning curve, especially if you don't have a sample project to work with
  • knowledge of XSL really helps
  • sometimes DocBook outputs extra & necessary tags
  • a lot of the heavy lifting is done at the customization layer file
  • difficulty getting your environment set up.

For more information about the docbook-to-epub process, see the DocBook page.

[edit] VCS

For any programming task or even the building of an eBook a Version control system can be useful.

Personal tools

MobileRead Networks