Archive for June, 2011

Creating Books For The Kindle Store Using Booki

Posted in Uncategorized on June 3rd, 2011 by James Simmons – Comments Off

As of May 16th my book Make Your Own Sugar Activities! is available for purchase in the Kindle store.  You can also download the first few chapters for free.

My Author Page

Putting a book on the Kindle Store is something any Booki author should routinely do with finished books.  It is a lot less work than putting a book on Lulu and the Kindle store has a lot more visibility.  I’m not suggesting that you give up on Lulu, just that you add the Kindle store to the ways you distribute your book.

Booki already does most of what you need to make a Kindle-formatted book, and OBJAVI *could* be modified to do the rest.  Until then you’ll need to do some work by hand:

1).  Export the book as an EPUB.

2).  Run the kindlegen program (a free download for Windows, Linux, and Mac OS) on your EPUB to create something that is readable on the Kindle.  This will NOT meet Amazon’s requirements for the Kindle Store, because it lacks a Table of Contents and a cover image, but the Kindle can use it.

3).  Using either the Kindle Previewer or a real Kindle look through the book for formatting errors and go back to Booki to fix them.  I found a problem with bullet points because I used Open Office to create the first few chapters of my book, then I pasted the chapters into Booki.  This caused my <li> tags to have <p> tags nested within them, a problem I would NOT have had if I had used Booki to write the chapters.  I was able to fix this in Booki by turning on HTML mode in the editor and getting rid of the <p> tags.  In the Kindle having the <p> tags in there makes the bullet appear on one line and the text appear on the following line.

Note that the docs on Amazon’s site say you can’t use <table> tags in your book.  That is wrong. The current Kindles display tables just fine.

Another thing you should do is add a section to your Introduction explaining how to get the book in various formats, including the website, Lulu, the Internet Archive, etc.  When people download the free sample of your book they will get this information.  If you’re writing a FLOSS Manual and have code samples in your book the Kindle will NOT render them well at all so you should direct your readers to the website so they can see the code properly formatted.  (Another possibility to suggest is the Kindle program running on a PC or Mac, which can take advantage of the wider screen).

The Kindle Previewer is available for Windows and Mac OS, but not Linux.  However, the Windows version runs under WINE.  It is too slow under WINE to be used to check every page for formatting errors, but it works well to verify that your cover image and Table of Contents are correct.

4).  Create a cover image and upload it to your book.  The cover image does not have to be linked to any page of your book, it just needs to be uploaded.  You can use the “Insert Picture” button in the editor, upload the image, then cancel out.  The image itself can start out as a white rectangle with a 5 pixel grey border.  I used a 600 x 800 canvas, but Amazon recommends something a bit larger.  You can easily create a usable cover image in The GIMP.  I put an orange rectangle with rounded corners at the bottom of the image which contains the same text that we put on the back covers of printed FLOSS Manuals.  I also put my name on the cover image as the author.  The printed book does not have that.  Amazon wants books to have authors.  You can have multiple contributors, including photographers, translators, etc. They will all be listed on the Kindle Store page.

5).  Re-export your book as an EPUB.

6).  Create a directory and unzip your EPUB into it.

7).  Make a copy of the XHTML file for your first chapter named something like ch000_table_of_contents.xhtml and use an HTML editor to make a Table of Contents out of it.  The free Seamonkey web browser from Mozilla has a perfectly adequate HTML editor that you can use for this.  Each chapter in the TOC must have a relative link to the chapter XHTML file that contains it.

8).  Use the same HTML editor to edit your Introduction chapter and put a centered <h1> entry with the title of your book at the top of the chapter.  Underneath it put a centered paragraph with “by Author Name”.  I chose to put this text in italics.

9).  Using a text editor edit the content.opf file.  You’ll need to fix the top of the file to be like this:

<metadata>
<dc:publisher>FLOSS Manuals http://flossmanuals.net</dc:publisher>
<dc:rights scheme=”License”>GPLv2+</dc:rights>

<dc:language>en</dc:language>
<dc:title>Make Your Own Sugar Activities!</dc:title>
<dc:creator>James D. Simmons</dc:creator>
<dc:date>2010-11-28</dc:date>
<dc:date scheme=”start”>2010.12.09-07.20</dc:date>
<dc:date scheme=”last-modified”>2011.05.13-00.00</dc:date>
<dc:date scheme=”published”>2011.05.13-18.25</dc:date>
<dc:identifier
id=”primary_id”>http://en.flossmanuals.net/epub/ActivitiesGuideSugar</dc:identifier>
<dc:identifier scheme=”booki.cc”>
http://booki.flossmanuals.net/make-your-own-sugar-activities</dc:identifier>
<meta name=”cover” content=”att000_MYOSA_Cover” />
</metadata>
<guide>
<reference type=”toc” title=”Table Of Contents” href=”ch000_table_of_contents.xhtml” />
</guide> 

Note that I have changed the creator to be myself and I’ve added entries pointing to the cover image and my new TOC page.  The TOC page will need its own <item> like this:

<item href=”ch000_table_of_contents.xhtml” media-type=”application/xhtml+xml” id=”ch000_table_of_contents”/>

The cover image should already have an <item> you can point to.

10).  Now you can zip up all these files and then change the suffix of the zip file to .epub.  kindlegen insists that you use a .epub suffix for the file.  .zip will not be recognized as an EPUB file by kindlegen.

11).  Run kindlegen against your new EPUB and you should have an Amazon-compliant MOBI file ready for the Kindle store.  (The file will be larger than your original EPUB because it generates images for several different kinds of Kindle outputs.  The MOBI that the customer gets will be sized like your EPUB, more or less).  Use Kindle Previewer or a real Kindle to check it out.  Also, pay attention to any messages coming from the kindlegen utility.  If you didn’t set up the cover image or the TOC correctly kindlegen should tell you.

Sign up for Kindle Direct Publishing, upload your book and your cover image, price the book at US .99, and in 24 hours or so the money should start rolling in.  Soon you’ll be eating lunch with the Algonquin Round Table and living a life that Richard Castle might envy.

Getting to Know Booki – Tutorial #17: …CSS Part II

Posted in Booktype, CSS & Books, Tutorials on June 3rd, 2011 by johncurwood – Comments Off

Two lessons ago, we looked at applying styles to paragraphs, this lesson we will look at changing how these styles appear when we export our books. And of course we will be using CSS to do it all.

To keep things simple, we will focus on the Normal <p> element and the heading <h1> to <h6> elements. Each of these elements associated with our paragraph styles has the same properties that can be adjusted using CSS. There are a lot of properties an element can have, but in this tutorial we will look at two text properties, text-align and color.

CSS Recap

First a recap – a CSS declaration starts with a selector (this is the element whose properties we want to adjust), and is followed by a declaration (a list of one more properties followed by a value that we want to set the property to). To make changes to the CSS of a book, go to the book’s Export tab, click on Show advanced options and then set CSS mode to Custom. Changes are made in the Custom CSS text panel.

To set the text-align property for an element use the following notation:

h1 { text-align:center; }

As you can see at the beginning of the rule we set the element we want to adjust (h1). The declaration used to adjust the style of our element is enclosed in braces ( { } ). The property we want to change, text-align is separated from the value we want to change it to, center by a colon (:). Finally the declaration finished with a semi-colon (;).

Every declaration ends in a semi-colon and all declarations are enclosed between the two braces. In the above example the entire rule is placed on one line, to aid human readibilit of CSS sheets, especially when there is more than one declaration, a rule is often split over several lines as follows:

p {
text-align:center;
color:red;
}

Basic Text Properties

text-align
As it’s name implies, text-align adjusts the alignment of the element. There are 4 basic values for this property: left, center, right, justify. these all apply the same settings as we covered in Tutorial #15: Paragraph Formatting.

color
This property sets the colour of the text for an element, the values used can take many forms: For common colours you can use their names, e.g. blue, red, green, black. For a complete list of predefined colour names visit http://www.w3schools.com/css/css_colornames.asp; For more comeplex colours you can use Hexidecimal, RGB or HSL colour notations. Hexadecimal defines a colour value using: #RRGGBB, where RR, GG, BB are values between 00 and FF representing levels of the three primary colours. RGB defines a colour using: rgb(red, green, blue), the parameters red, green, blue are specified by a number from 0 – 255 or a percentage from 0%100% and represent levels of the three primary colours present in the text colour. HSL defines a colour using: hsl(hue, saturation, lightness), hue is a value between 0 and 360 (o or 360 give red, 120 gives green and 240 is blue); saturation is a value from 0%100% and represents the level of the colour defined with hue (0% gives grey while 100% gives the colour’s full intensity); lightness is also a percentage from 0%100% and defines the amount of light in the colour (0% gives black, 100% gives white and 50% gives the full colour defined with hue and saturation).

The following rules all give the same colour to h1:

h1{color:green;}

h1{color:#00FF00;}

h1{color:rgb(0,255,0;}

h1{color:rgb(0%,100%,0%;}

h1{color:hsl(120,100%,50%;}

Have a Go!

Right, the first thing is to have the chapters in your test/play book contain a chapter heading (heading 1), some headings formatted to heading 2 and some headings formatted to heading 3. You will also want to have some paragraph text formatted to Normal (See Tutorial #15 to adjust paragraph styles).

Once that is ready click on the Export tab, show the advanced options and set the CSS mode to Custom. Under Custom CSS, scroll down to the bottom, create a new row and enter declarations for h1, h2, h3 and p using the layout shown at the top of the tutorial. Set values for the text-align and color properties for each element. With the color properties try using a different declaration method for each element as I have done in the following:

h1 {
text-align:right;
color:blue;
}

h2 {
text-align:center;
color:#FF00F0
}

h3 {
text-align:left;
color:rgb(255,50,0);
}

p {
text-align:justify;
color:hsl(180,100%,30%);
}

When you’ve finished, click Publish, Objavi will generate the pdf of your book. Once it has finished, click the download link at the bottom of the page, and open the pdf.

Browse through the document, and notice the new changes, also notice what hasn’t been changed. For instance, the Table of Contents text and Section headings all remain black, with their original alignment. If you have a large well filled out testing book, you will also notice that numbered and bulleted lists are still black. The two lists belong to the ol (ordered list – or numbered) and ul (un-ordered list – or bulleted) elements, which need their own set of declarations, to change the color property.

If you want all text in your book to be a certain color, you don’t have to go through, listing each element and declaring the color property, CSS has provided the body element, which for Booki, means everything in the chapter, use the body element to make global changes to your book design. If you want all text in your chapters to be blue, except for the h1 headings which will be green, you can set everything to blue using the body element, then set the h1 color to green. The h1 declaration will override the body declaration, setting the h1 text to green and all other text to blue.

If you have any questions or need any help using Booki go to http://support.booki.cc and post your question to our Q&A forum.

You can also join the Booki discussion by signing up at http://lists.booki.cc/listinfo.cgi/booki-booki.cc

Have fun and happy writing.

John Curwood

Booki User Guide maintainer.