Thursday, December 22, 2016

Converting ODT to EPUB or MOBI using Calibre

This post will likely seem off topic for the typical readers of our blog. It is concerning the process of publishing eBooks. Now that we are deep into the throws of the publishing world, these details are a big part of daily life!

Background: The books I am writing are being written in Libre Office on Ubuntu, saved as .ODT files. The conversion to PDF is simple, as Libre office has a "export to pdf" function that works amazingly well and all features of Libre seem supported in the resulting near perfect PDF file.  PDF is fine for self publishing and distributing off a website such as this, but none of the major eBook retailers support PDF. 

The reason is simple... PDF is a really cool and flexible set design format. It allows creativity to place objects and text around the page as in written works. EBook reader, however, do not accept PDF.  They prefer a format that allows restructuring on the fly to fit a variety of screen sizes and shapes and resolutions. this presents a problem for PDF becasue  the exact thing that PDF is best for, fixed structure, is something not allows in the ebook reader world. These readers work more like a web browser, dynamically flowing text to match as things are scaled up and down on various platforms. 

So, The next step in our process was converting to EPUB and MOBI (for Barns &Noble and Kindle respectfully).  WOW, what an experience this was! I chose to use the converter software called Calibre becasue has the highest recommendations and most control. Calibre will acept many formats and spit out many other formats, mostly right. What it cant do is deal with a fixed structure format in a flowable world.  This caused many hours of searching the help pages, the internet, and finally trial and error.  There just isn't much information available because of the vast number of possibilities of input format to output format. 

I wanted to document what I learned specifically about converting ODT to EPUB using Calibre on Ubuntu. (I dont thin the OS matters at all, but worth mentioning). Here is the list of issues to deal with that are not well documented:

A. Graphics and captions

Libre Writer allows frames to hold the captions of graphics in a nicely formattable way.  NOT COMPATIBLE WITH CALIBRE! The frames themselves do not get interpreted properly and mess up the page.  The only option seems to be:
  1.  remove captions and paste graphics only (anchored to paragraph text)
  2. Place the cations into the graphics themselves
B. Table of Contents

Libre Writer does a fabulous job of building and maintaining a table of contents automagically. Unfortunately this is wholly incompatible with Calibre.  Instead, use the Calibre "create table of contents" feature based on headers in the document, and remove the embedded table of content entirely. This is ok, as it actually makes no sense to leave it. EBOOKS have no page numbers, because the pages are fluid as the text flows to fit. The Calibre created TOC is not based on page numbers, but clicks to go there. That works well.  Unfortunately this does mean keeping two copies of a finished doc, one with TOC for PDF, and one without TOC for EPUB

C. Track Changes

Calibre has this interesting quirk, anything it doesn't understand is just thrown into the front of the ebook, sort of like its saying "I don't know about his part, so look here first. Changes pending under the Libre "track changes" feature are one of those that it doesn't understand. Be sure to accept or reject all changes within the document before conversion to EPUB. 

D. Page Breaks

Calibre will add page breaks where it or you wants to. This si controllable in the conversion settings. You can choose which level of headings create breaks, H1, H2, N3, etc.  The default is to break after both H1 and H2. This is easily adjustable if its not what you want.

E. Embedded fonts

If you care about the final look and formatting, embed the fonts used. Dont depend on the font being available on the reader device. Substitute fonts are never perfectly alike and causes weird changes.  This is easily settable in the conversion setting of Calibre

F. Tables

this is perhaps the most difficult one! Tables are a way of force formatting text on a page. Again, totally incompatible with the goal of eBook readers.  There are options on this:

  1. Do not use tables, organize in some text only fashion that makes sense
  2. Use tables and let Calibre "flatten them", which pretty makes the table unreadable
  3. Use Tables and let Calibre leave them tables, which makes them mostly unreadable since they fall off the edge of the reader screen into oblivion
  4. Build the table in a graphic program, save as an image, and paste it into the document
Number four is the only one that truly works and preserves the layout of the table. It is a pain though since it means more objects to manage to build a book when changes are necessary. 

E. Cover
Several options on what to do with a cover. Calibre can expect an outside file as the cover, but if you do that and also produce PDF, you must maintain two copies again (one with and one without cover embedded).  What I ended up doing is making a full page graphic for the cover, text and all, and putting that on the first page of the document.  then do not tell Calibre to use a graphic nor to use the first page. Just leave all cover settings alone. That produces a PDF and EPUB that look identical with no intervening steps. 

One thing I did do is to set Calibre to scale the cover proportionally... that preserves the look of the cover as it stretches onto different device screens. 

F. Properties

Calibre is supposed to pick up "customer document properties" from Libre Writer, but I have not been able to get this to work. What that means (if I cant solve it) is that each time a new file is converted, you have to enter the properties like author, publisher, etc manually. You do what these to allow for better searching within the ebook retailer. 

That's about it for now...  Nearly at a usable EPUB file !







No comments:

Post a Comment