Friday, March 04, 2011

My ordeal publishing Kea's Flight

Well, now that I've published our science fiction novel "Kea's Flight" on iTunes and Amazon, I thought it might be helpful to share some of the things I've learned about the process, to help other authors who may be as new to this whole business as I am.

When you want to publish an ebook on iTunes, you have to submit it to the site as an epub file, the universal e-reader format. But getting it into this form can be a hassle. There are online converters that can transform other types of files into epub, but they almost always leave flaws, like unwanted paragraph breaks. So, prior to uploading your document into a converter, you'll have to get it ready.

Lulu.com, the site where I published the print version of our novel, will charge you a hundred dollars or more to convert your document into epub form. I consider that quite reasonable-- this process took me long enough that, if I were doing it for someone else, I would fully expect over a hundred dollars of payment. And Lulu probably makes the final product look a lot sleeker than I did. But I don't have a spare hundred bucks for something like that, so I put quite a bit of effort into figuring out how to do it on my own.

Here is the way I prepared the file for epub conversion. There are probably better ways that I don't know, but this is a combination of advice I found here and there, and it has worked for me so far.

I saved the file as an HTML document. If the document is a file type like .doc or .rtf, you can do this by opening it in Microsoft Word or an equivalent (I use NeoOffice) and choosing Save As, then choosing HTML as the file format.

I opened the HTML file in an editing program. On a Mac, you can do this by starting up TextEdit, going to "Open," choosing the HTML file, and checking the box labeled "ignore rich text commands" before you open it.

I edited the HTML file to eliminate unnecessary formatting. Here is an outline I've come up with for making an HTML file to convert to epub:



<HTML>

<head>
<META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/HTML; charset=utf-8">
<title>The title of your document</title>
<meta name="description" content="description of your document" />
<meta name="keywords" content="words describing your document" />
<meta name="author" content="your name" />
<meta name="publisher" content="your name" />
</head>

<style> .break { page-break-before: always; } </style>

<BODY LANG="en-US" TEXT="#000000" DIR="LTR"> <FONT FACE="Times New Roman, serif"> <FONT SIZE=3>


<P>Making an ebook in HTML</p>
<P>(This is the title page)<p>

<h1 class="break">
Chapter 1
</h1>

<P>Paragraphs
<br>and line breaks</br>
</p>

<p>Paragraphs should begin with a paragraph opening tag, and end with a paragraph closing tag.</p>

<p>If you want to choose where a line break happens within a paragraph, use a line break like the one in the subtitle of this chapter.</p>

<h1 class="break">
Chapter 2
</h1>

<P>Page breaks</p>

<p>On an e-reader, a page break will happen automatically after a certain amount of text, but you probably want to make sure each chapter starts on its own page.</p>

<p>To choose where page breaks will happen, add the code that I have added between the head and body of this document. Then, at the beginning of each chapter where you want to make sure a page break happens, add tags like the one I have added at the beginning of this chapter, with the chapter heading between them.</p>

<h1 class="break">
Chapter 3
</h1>

<P>Formatting</p>

<p> You can use HTML to add <i>italics</i> or <b>bold</b> or <u>underlines</u>. Symbols like "straight quotes" --or double hyphens-- can be changed into &#8220;smart quotes&#8221; &mdash;or long dashes&mdash; using special tags, as shown.</p>

<p>You can use tags to make the font <font size="+2">a different size</font> or <font face="Georgia">a different face</font> from the font specified at the beginning of the body of the HTML document. <font size="+2"><font face="Georgia"> You can even do multiple things at once.
</font></font>

<P><b>Does your document have a multi-paragraph section that needs to be in bold or italic? If so, put the tags on the beginning and end of each paragraph in that section.</b></p>

<P><B>If you're making a page for a website, you can sometimes get away with avoiding that step, but it is necessary if you're making an HTML file to be converted to epub.</b></p>

<P><B>If you only put the bold or italic tags at the beginning and end of the whole section, the epub file won't know what to do with them. Only the first paragraph of the section will show up as bold or italic. So be sure to tag each paragraph.</b></p>

<p>Also be sure to close all your tags. There has to be a closing tag for each opening tag. Even the "body" and "HTML" tags at the beginning of the document must be closed at the end.</p>

</body></HTML>





That was a basic intro to HTML, with a few epub-specific details added. My HTML file contained a lot of stuff more complicated than that, so I took it out. Each paragraph started and ended with a dozen assorted tags, instead of one paragraph opening tag and one paragraph closing tag, so I used the Find and Replace tool to change that throughout the document.

It took several hours to do this editing project. An HTML editing program can help make sure all the tags are closed properly. I used Amaya because it can edit long files, even my 600-page book, and it has a convenient tool for viewing all parsing errors in the document.

I opened my HTML document in a browser to check the results of the editing, and used the print preview option to see where the page breaks would be. When I thought I was satisfied, I uploaded it to http://iiiconverter.com/ and had it made into an epub file. Then I transferred the epub file to my iPod Touch to see how the ebook would look to my readers.

After I made sure the document looked okay on the device it'll be read on, I had to make sure it passed Apple's quality standards. ThreePress has a tool to check the "validity" of an epub document.

When I uploaded my epub file there, it gave me a huge long list of errors. At first glance, I had no idea how to correct them. I did some research, and found Sigil, a program that lets you edit epub files.

I opened my epub file in Sigil, chose "code view," and found that the conversion from HTML to epub had moved some stuff around. One of the "style" tags that manage page breaks had changed location, and after I moved it, that got rid of most of the errors. But Threepress kept telling me that my epub had an "unfinished element."

After some more research, I figured out that meant I was missing the meta name="publisher" tag in the head of the document. Once I added that in Sigil, my epub passed the check when I uploaded it to Threepress.

But it still wasn't perfect. A certain area of text had somehow gotten stuck in the wrong font size, which I noticed when I paged through the epub after putting the latest version on my iPod Touch.

I looked at the code in Sigil, and at first it was confusing, because epubs use different code from regular html pages. But I noticed that every paragraph before and after that section began with <p class="calibre2"><span class="calibre4"> and ended with </span></p> ...while the paragraphs in that section, for some reason, were missing the "span" tags. So I added them, and that fixed the problem.

To add the cover image, I opened the epub file in Sigil, right-clicked on the list of html files, and chose "Add New File." I moved the new file to the top of the list, renamed it "cover.html," and replaced the text in it with this:


<?xml version="1.0"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Cover</title>

<style type="text/css">
img { max-width: 100%; }
</style>
</head>

<body>
<div id="cover-image"><img alt="Kea's Flight" src="../Images/the_cover.jpg" /></div>
</body>
</html>


Then I right-clicked on the Images folder, chose "Add existing file," and added the cover image, which I had named "the_cover.jpg." I downloaded the epub file to my iPod touch again, to make sure the cover showed up properly.

Instead of uploading my epub directly to iTunes, I decided to do it through Lulu, which is a certified aggregator. They automatically give the book an ISBN and submit it to the iBookstore. All I had to do was start a new Lulu project-- an ebook-- and upload my epub and enter the information it asked for.

At one point there was some difficulty-- a bug in the version of Sigil I was using caused my epub file to be rejected for "permission errors" when I uploaded it to Lulu, even though Threepress said it was valid. I ended up doing the rest of my revisions in eCub, since the latest version of Sigil seemed to have a bug that made it impossible to make valid files with it.

Now, Ecub is not designed for just opening up an epub file and editing it-- you have to "create a new project" from an existing epub file or a bunch of html files. And on my computer, for some reason, creating it from an existing epub file didn't work-- it froze up. So I had to create it from the files that made up the epub file.

One way to do this is to make a copy of the epub file, rename the file extension from "epub" to "zip," and unzip it. Then go into the resulting folder, take all the documents from the folders "Images," "Styles" and "Text," put them in the same folder, and use that as the folder for the Ecub project. (Unfortunately, I couldn't do this with the version of my epub that I had made with the buggy version of Sigil-- it was so buggy that when I unzipped it, it created another zip file instead of a folder. So I had to unzip an earlier version, and make any necessary edits in Ecub.)

I also decided to remove the Table of Contents that Ecub automatically generated, since it didn't seem to be useful for my book. I did this by choosing "Edit," then "Options," and unchecking "Generate TOC." I also noticed that each chapter had been automatically named "Kea's Flight," so I went through the chapters in eCub and named them "Title page," "Copyright info," "Dedication," "Illustration," Chapter 1," "Chapter 2" and so on.

Then, when editing the project in Ecub, I had to go through all the files and remove the text "../Images/" or "../Styles/" wherever it referenced a document that used to be in one of those folders. Once that was done, I could hit the "Compile" button, make an epub file, and successfully validate it on Threepress and upload it to Lulu. (Whenever I wanted to edit the file after that, I just opened the file called "KeasFlight.ebkproj" and made the necessary edits, then hit Compile again to re-create the epub.)

As for publishing an ebook on Amazon, that's here, and it's a simpler process. As far as my book goes, uploading a .doc file I made in Pages seems to work out better than uploading an epub file to Amazon.

In the .doc file, I just had to make sure there were page breaks between chapters, by going to "Insert" and choosing "Page Break" wherever I wanted one. With a bit of trial and error I figured out what the right formatting for the title page and copyright page was, and then it was fine.

Once it's uploaded to Amazon, there's a tool you can use to preview how it will look on a Kindle. I tried it and my book looked OK, though not quite as sleek and shiny as some other people's books.

The print book from Lulu was the easiest of the three versions. They take a PDF and print it just the way it is.

No comments: