Search This Blog

Tuesday, June 26, 2012

Using Open Office and Calibre for Ebook Creation

In my book, How to Make an Ebook: Using Free Software, I detail a method for creating epub, mobi, and in the appendix, pdb ebooks. One of the ways to accomplish that was through using some Open Office Writer add-ons for the epub and pdb ebooks. You could also create those through using Calibre, but I found, at the time, that the conversion from Open Office's odt file to be a bit buggy when it came to graphics.

That has since improved, and I've also discovered some steps you can take to ensure a more accurate graphic representation. I will be updating the ebook in the near future. But wanted to get this modification out also on my blog for any that can use the information before I get the ebook updated. Here are the steps which are more simplified using this method, and avoids some of the bugs of the method in my book (like the epub add-on, you couldn't use apostrophes in the description field without the app crashing).



Step 1: Set up your file as instructed in the book. I also have the post here that talks about that, and is virtually unchanged from what is in the book, as far as content. Check that out first if you haven't, and either ensure your file is set up correctly or start by typing your file correctly. I will assume you've done that for the purposes of this post.

Step 2: Set up your Open Office document/source file.

  1. If you created the document in Word, open it in Open Office Writer.

  2. Remove excess blank lines. You should have no more than two or three. Four at the most, but for readability on a small screen, you don't want a bunch of blank lines creating blank pages. For our purposes, you don't need any blank lines between the end of chapters and the chapter headings. See the book in the chapter on preparing the Smashwords document for more information on how to remove those using the search function.

  3. Ensure a new page has been created before each chapter heading. In Open Office, press F11, right click on the Heading 2 (or whichever heading style you used to set up your chapter headings with), select "modify," and then click on the "Text Flow" tab, then in the "Breaks" section, check the box that says "Insert." Ensure that "Type" is set to "Page" and "Position" to "Before." Click OK to save changes.

  4. Check each graphic to ensure it is anchored to the character. Right-click on the graphic, and hover over "Anchor" in the menu. Select "To Character" in the sub-menu. This will help preserve centering and formatting of the graphic in the conversion.

  5. Check each graphic to ensure it is sized correctly. This is one of the keys, because if you have inserted a graphic and changed the size within Open Office or Word, the Calibre conversion will return the graphic to its original size. This is what messes up the ebook conversions on graphics with Calibre. The easiest way to check this is to select the graphic in question, right-click on it, select "Picture" from the menu, then the "Type" tab when that window opens. You'll see a button in the "Size" section labeled "Original Size." Click that button. If you see the dimension changes, you'll know this picture will change sizes in the conversion. Click the OK button to save the change to restore the graphic to its full size. It may distort your layout for a while, but have no fear, we will change it back. Because now we need to change the picture itself.

    • Select the picture and copy it.

    • Paste the picture into your favorite graphics program and resize the picture to a size you think will work best.

    • Copy the picture, then return to Writer and paste the new sized picture over the current one. You should see the size of the picture change to more fully represent what it will actually look like in a conversion.

Sometimes, the size looks a little different in the conversion. You may, upon seeing the resulting epub file, decide you need to size up or down some more. Come back and edit your source file's pictures as above, but do so in the Calibre folder (Right-click the title, and select "Open Containing Folder" in Calibre) so that you don't have to re-import the odt file.

Step 3: Open Calibre and import the odt file. Click on "Add books" and browse to find and select the Writer odt file for your story. Once imported, click on "Edit metadata" to include the author name, title, cover art, description, tags, ISBN if you have one, etc. Save.

Step 4: Create the Epub file.

  1. Ensure the story is selected in the title list and click on "Convert books."

  2. ODT should be selected as the input format, and EPUB as the output format.

  3. Under the "Look Feel" section (selected on the left pane of the window), click the "Remove spacing between paragraphs" box.

  4. Under "Structure detection," mark and cut the text in the "Insert page breaks before" field and leave it blank. The page breaks in the odt file will do the job and you don't want duplicate page breaks.

  5. Under "Table of Contents," paste the text you cut from the previous section into the "Level 1 TOC" field. If you use both Heading 1 and Heading 2, and want the 2s to be sublinked under the 1s, paste it into the "Level 2 TOC" as well, and remove the " or name()='h2'" from the "Level 1" field, and remove the "name()='h1' or " from the "Level 2" field.

  6. Under "EPUB Output," ensure that the "Preserve cover aspect ratio" is selected.

  7. Click the OK button and the conversion will take off.

  8. Once finished, go to the "Containing Folder" as instructed above, and check the epub file as outlined in the book.

Step 5: Create the MOBI file.

  1. Ensure the title is selected in the list and click on the "Convert books" button.

  2. Use "EPUB" as the input file, and "MOBI" as the output format.

  3. Ensure the settings are the same as above, except there will not be a "Preserve cover aspect ratio" box to check in the "MOBI Output" section.

  4. Click OK to start the conversion, and check the file as outlined in the book.

Step 6: Create the PDB file. This one is a little more complicated, and because it isn't as popular of a format as the others, you may elect not to use it. But in case you want to offer it for sale, here's how to do it using Calibre. Whether this method is any better than the one in the book, you can be the judge. They both require some manual formatting of the graphics and the use of Ereader's Dropbook program.

  1. Select the title in the list and click on "Convert books."

  2. Use "EPUB" for the input file and select "PMLZ" as the output format. NOT PDB. It doesn't tend to convert the graphics very sharply, so we have to set it up manually and use Ereader's "Dropbook" software to actually create the book. But this will create an good source file to convert with.

  3. Ensure the settings are as we set them above, and click the OK button to start the conversion.

  4. Once done, open the "Containing Folder" as mentioned above, and right-click on the PMLZ file, select "rename," and change the "pmlz" ending to "zip". Then right-click on the file again and select "Extract all" and extract the zip file into its own folder (in Windows, or use the method available in other operating systems to extract a zip file).

  5. Double-click on the newly created folder if needed, and you'll see a file labeled "index.pml" and a folder labeled "index_img." Double-click on the "index_img" folder to see its contents. You should see a "cover.png" if you had a cover, and other names for any other graphics included in your book.

  6. Change the size of the cover as instructed in the book, and save it as a 256 color file instead of "True Color" as instructed in my book. Open and save each graphic as a 256 color file.

  7. Once that is done, return to the previous folder containing the index.pml file. Open Dropbook and create the PDB file as instructed in the book.

  8. Return to the folder containing the index.pml file. You will see the resulting pdb file there. Rename it to match the Calibre formatting, usually (title)-(author name).(ebook extension), and move it to the main folder with the other ebooks, if you wish.

Note: the resulting PDB book will not show up in Calibre's list of available ebooks even though it is in their folder. You will know it is there and can move it wherever you want to store it. Just know it is invisible to Calibre. I tried creating a pdb in Calibre by re-zipping and changing it back to a pmlz file, but the graphics still looked horrible despite the manual changes. So if you use any kind of cover image or graphic and want a pdb file, it requires using Dropbook to get a copy with a good looking cover.

That's it! You've created and Epub, Mobi, and Pdb file from an Open Office source file. To avoid having to edit the graphics before conversion, it is best to change the actual graphic size before importing into your document instead of resizing once in the document.

No comments:

Post a Comment