Creating e-books with OOo FBTools

Novel Ideas


With OOo FBTools, you can create, edit, and customize your own e-book in the FictionBook format.

By Dmitri Popov

Plenty of places have e-books free of charge or for purchase, but what if you want to create your own e-book? Although not all of us have the next big novel lying in a drawer, a tool for creating e-books can come in handy for less ambitious projects, too. For example, you could save articles and tutorials from the web and convert them into nicely formatted e-books. With an e-book reader, you would have access to them on your computer or mobile device. Those of you who write for a living might want to convert documents into e-books for archival purposes. And, if you use OpenOffice.org Writer as your tool of trade, you'll be pleased to learn that you can convert existing documents and create e-books from scratch without leaving your favorite productivity suite, courtesy of OOo FBTools [1].

Before you install the OOo FBTools extension and put it to some practical use, you should know that it allows you to create e-books in the FictionBook [2] format. Developed in Russia, this format shares a lot of similarities with the EPUB e-book format. Like EPUB, FictionBook is an open XML-based format that provides support for essential formatting features, such as text and paragraph styles, hyperlinks, tables, and headings (Figure 1). Although FictionBook might not be as popular as EPUB, many e-book readers provide support for FictionBook. This includes FBReader [3], one of the best e-book open source readers available for Linux and Android devices.

Figure 1: OOo FBTools offers a wide range of tools that can help you format your document and turn it into an e-book.

Installing OOo FBTools

Because OOo FBTools is distributed as an .oxt package, installing it is as easy as any standard OpenOffice.org extension. To do so, choose Tools | Extension Manager, press Open, select the OOoFBTools.oxt file, and press OK. When you restart OpenOffice.org, you should see the OOoFBTools menu in the main menubar. Besides the extension, you have to add the fb21_styles template bundled with OOo FBTools. To do this, choose Files | Templates | Organize, select My Templates in the left pane, and then select the Import Template item from the Commands drop-down list. Then select the fb21_styles template and press Open.

Getting Started with OOo FBTools

Before you let OOo FBTools convert your .odt file to an e-book, you must properly format the document using the styles from the fb21_styles template. To load these styles, choose the Load Styles Template In Text command from the OOoFBTools menu. Then you can see the template styles in the Stylist window (press F11 to activate it).

OOo FBTools uses three types of styles. The so-called inline styles are basically character styles that you can use to format text fragments and characters. The supported inline styles include bold, italic, underline, superscript, subscript, and a few others. To apply any of these styles to a selected text snippet, use either the formatting buttons in the main toolbar or the Style submenu in the right-click context menu.

OOo FBTools also sports a few custom paragraph styles for formatting the document's structure and specific content, including Book Title, SubTitle, Cite, Poem, and head levels 1 to 10. Finally, OOo FBTools uses special "Service" styles for formatting e-book metadata, such as the author's name, publishing date, publisher, keywords, genre, and so on (Table 1). OOo FBTools includes both paragraph and character styles for formatting metadata. For example, you can use the #Book Author paragraph style to mark the paragraph containing information about the author and use the #Name, #Family, and #Email character styles to format the author's first name, last name, and email address, respectively. As long as you don't change the styles' names, you can edit the properties of any style used by OOo FBTools. To do this, in the Stylist window, right-click on the style you want to edit, choose Modify, then tweak the style's properties to your heart's content.

OOo FBTools allows you to use your own styles, which comes in handy when you want to convert a document but you don't want to reformat it with OOo FBTools' own styles. To reassign the styles, choose OOoFBTools | Set User Styles. This opens the Definition of the user styles window, where you can replace the default styles with your own (Figure 2). Before you press the Apply button to save the changes, you might want to export the custom profile using the Save Profile button, just in case you plan to use the same style settings with other documents. The Load Profile button lets you import an existing profile file.

Figure 2: You can replace default OOo FBTools styles with your own.

Formatting Documents

Formatting text with OOo FBTools styles is not particularly difficult (Figure 3), but there are a few things you need to keep in mind. Although OOo FBTools can process simple tables consisting of rows and columns, it doesn't support nested tables, so they are simply ignored during conversion.

Figure 3: Using OOo FBTools styles to format the document.

OOo FBTools supports text frames, but it only recognizes frames anchored to paragraphs and characters. If the document contains frames anchored to pages or anchored as characters, you must change them before conversion. OOo FBTools can export frames as plain paragraphs, quotations (with the <cite> tag), tables, or formatted paragraphs.

OOo FBTools can process images in the document, but as with text frames, it can't handle graphics anchored to pages. Although the e-book file can contain images in many different graphics formats (e.g., BMP, TIFF, GIF, etc), many e-book readers support only PNG and JPG. To solve this problem, OOo FBTools converts graphics in the document into PNG or JPG on the fly during the export process. To perform this trick, OOo FBTools uses the base64 utility, which is installed by default on most mainstream Linux distributions. OOo FBTools also supports book cover images. By default, OOo FBTools considers any image placed before the paragraph formatted with the Book Title style to be a book cover.

With the use of a simple trick, you can create cross-references in your book. To do so, you first must add a bookmark to the target paragraph. Then choose Insert | Bookmark, give the bookmark a name, and press OK. Next, select a text fragment that will point to the target paragraph, choose Insert | Hyperlink, and enter the name of the bookmark in the Target field.

Running the Converter

Once you're done formatting the document, choose the OOoFBTools| Export to fb2 format command. This opens the export dialog window where you can provide additional information about the book (Figure 4). Most of the fields are optional, and you only need to fill out a couple of mandatory fields marked with red. If you specify metadata in the document itself, OOo FBTools inserts this information into the appropriate fields. If you plan to reuse basic book and author information, you can save it as a profile by pressing the Save Profile button. You can later load the saved profile by pressing the Load Profile button.

Figure 4: Specifying the e-book's information before export.

Before you hit the Create fb2 file button, you might want to tweak how the converter will process the document. To begin, press the Settings button to open the More Settings dialog window (Figure 5). Here you can, among other things, specify how OOo FBTools should deal with graphics files, formulas, diagrams, and text frames.

Figure 5: Configuring export settings.

In the Style drop-down list, you can choose between different footnote styles. If you want OOo FBTools to remove blank lines automatically while exporting, tick the Remove Empty Paragraphs checkbox. The Tables section lets you specify the alignment options for table headings and rows. Also, you can define the so-called Service Zone, or the place in the document containing the metadata.

When you're satisfied with the settings, close the More Settings dialog window and press the Create fb2 file button to generate an e-book file. Then, open your freshly baked e-book in a reader application that supports the FictionBook format and start reading (Figure 6).

Figure 6: Viewing the result in FBReader.

Final Word

If you plan to make a living selling e-book versions of your documents, OOo FBTools might not be the right tool for the job. But if you need a quick-and-dirty way to turn documents into e-books for easy reading, then OOo FBTools is a good choice. Becoming familiar with all OOo FBTools' formatting intricacies can take some time, but once you've mastered them, you can produce nicely formatted e-books like a pro.

INFO
[1] OOo FBTools extension: http://code.google.com/p/ooofbtools/
[2] FictionBook format: http://www.fictionbook.org/index.php/Eng:FictionBook
[3] FBReader: http://www.fbreader.org