Generating EPUB documents with a click
Metamorphosis
The writer2ePub plugin for OpenOffice Writer converts formatted files to compatible data for many of the popular e-book readers at the press of a button.
The Open/LibreOffice suite of programs owes its popularity to the stability of the software and its extensibility through plugins. Thanks to its modular design, you can customize the program to suit your needs in just a few simple steps. In addition to a plugin for importing simply designed PDF files [1], OpenOffice also has an extension that lets you convert text from Writer to the open EPUB format [2]. With the right choice of software, these documents are then available for PCs and smartphones.
Approach
Standalone programs for generating EPUB documents are of very limited use for composing text. They usually offer only basic functions for designing a cover page and formatting the text. Programs like eCub or Jutoh fail if the document to be edited contains hard line breaks or you want to use a justified layout. Automated functions such as search and replace are not available or, in many cases, are only rudimentary. Thus, you have to consider preparing the files that need to be converted to EPUB format with a word processor up front; then, when you save the data, you must make sure to store it in a readable format for EPUB-building software to keep as much formatting as possible.
The OpenOffice writer2ePub [3] extension takes a completely different approach. This OpenOffice Writer component converts an existing document directly from ODT to EPUB format, removing the need to use a separate program and eliminating that annoying post-editing work. Similarly, you have no need to learn the details of the EPUB format and its many tags.
Installation
To add the writer2ePub plugin to an existing OpenOffice or LibreOffice installation, first download the appropriate (OXT) file from the web [4]. Pay attention to your office suite version; writer2ePub comes in three version: one for OpenOffice 3.x, one for version 4.x, and a beta version with additional features. After downloading, click Tools | Extension Manager to open the dialog for adding plugins. Press the Add button, look for the OXT file you saved, and add the extension.
When you restart OpenOffice, you will see three new icons on the far left in the OpenOffice toolbar, or in the beta version, you click the writer2ePub icon on the left to open a new pane with the icons (Figure 1).
The rightmost icon, Preferences, lets you set the default global settings for the EPUB generator. Only a few basic options are available, and it is usually fine to keep the default values (Figure 2). By clicking the center button, you can add metadata to a document, such as the title and author of the work, the ISBN number, and year of publication. You also can choose the e-book cover here. If the details for the main metatags are missing, the OK button is grayed. The empty data fields then have a red label, so you can see at a glance where information is missing (Figure 3).
Hands On
In our lab, we tested writer2ePub with various text files initially formatted in OpenOffice 3.4.1 and LibreOffice 3.5. When converting, the plugin achieved quite reasonable results: It easily converted simple text without special formatting such as footnotes or tables of contents to EPUB. However, in more complex texts, some errors occurred, or the process stopped.
The plugin added images to the document; however, you will want to center them in the original OpenOffice document to avoid potentially moving text around. The images can also use various formats. It does not matter whether they are line drawings or color photos, but you do need to pay attention to the file size: In the plugin Preferences dialog, an Image Dimension Limit (Kb) entry lets you define the maximum size of embedded graphics and images as needed. Larger values here are not necessarily beneficial: The more pictures you add to the text, the slower the finished document loads.
The software also converts unformatted files in .txt
format without problems. One thing you notice when you view simple files like this in standard EPUB readers is that they often use the wrong fonts. For example, a file opened in FBReader using the standard Courier font was converted to a document in italics.
Because left-justified text can be difficult to read, depending on the window size, it makes sense to justify the document left and right. To do this, select the default style in OpenOffice. This gives you an easily readable serif font, which you can then change in size to suit your needs. Special paragraph attributes, such as bold, italic, and underline, are also possible. Once you have adjusted everything, highlight all the text and click the Justified icon.
Note that you cannot use automatic hyphenation if you want typical readers to render the file correctly. The hyphenation function in OpenOffice in particular trips up FBReader, causing it to separate words without using hyphens. After completing the formatting, you need to save the document in ODT format and then generate the EPUB document by clicking the leftmost button. The software creates a file in your working directory with a .epub
suffix.
Results often depend on which e-reader is used to look at the EPUB file. Okular, the default reader in many distros, failed to place the image correctly, allowing text to flow behind it, and it lost the left justification (Figure 4). FBReader, however, placed the image well and maintained justification but converted the font to sans serif instead of the Liberation Serif font used in the original document. The built-in KDE e-book viewer, however, used the correct typeface, although text with hyphenation appeared gappy in a small display window.
Buy this article as PDF
(incl. VAT)
Buy Linux Magazine
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters
Support Our Work
Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.
News
-
Latest Cinnamon Desktop Releases with a Bold New Look
Just in time for the holidays, the developer of the Cinnamon desktop has shipped a new release to help spice up your eggnog with new features and a new look.
-
Armbian 24.11 Released with Expanded Hardware Support
If you've been waiting for Armbian to support OrangePi 5 Max and Radxa ROCK 5B+, the wait is over.
-
SUSE Renames Several Products for Better Name Recognition
SUSE has been a very powerful player in the European market, but it knows it must branch out to gain serious traction. Will a name change do the trick?
-
ESET Discovers New Linux Malware
WolfsBane is an all-in-one malware that has hit the Linux operating system and includes a dropper, a launcher, and a backdoor.
-
New Linux Kernel Patch Allows Forcing a CPU Mitigation
Even when CPU mitigations can consume precious CPU cycles, it might not be a bad idea to allow users to enable them, even if your machine isn't vulnerable.
-
Red Hat Enterprise Linux 9.5 Released
Notify your friends, loved ones, and colleagues that the latest version of RHEL is available with plenty of enhancements.
-
Linux Sees Massive Performance Increase from a Single Line of Code
With one line of code, Intel was able to increase the performance of the Linux kernel by 4,000 percent.
-
Fedora KDE Approved as an Official Spin
If you prefer the Plasma desktop environment and the Fedora distribution, you're in luck because there's now an official spin that is listed on the same level as the Fedora Workstation edition.
-
New Steam Client Ups the Ante for Linux
The latest release from Steam has some pretty cool tricks up its sleeve.
-
Gnome OS Transitioning Toward a General-Purpose Distro
If you're looking for the perfectly vanilla take on the Gnome desktop, Gnome OS might be for you.