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
-
Juno Computers Launches Another Linux Laptop
If you're looking for a powerhouse laptop that runs Ubuntu, the Juno Computers Neptune 17 v6 should be on your radar.
-
ZorinOS 17.1 Released, Includes Improved Windows App Support
If you need or desire to run Windows applications on Linux, there's one distribution intent on making that easier for you and its new release further improves that feature.
-
Linux Market Share Surpasses 4% for the First Time
Look out Windows and macOS, Linux is on the rise and has even topped ChromeOS to become the fourth most widely used OS around the globe.
-
KDE’s Plasma 6 Officially Available
KDE’s Plasma 6.0 "Megarelease" has happened, and it's brimming with new features, polish, and performance.
-
Latest Version of Tails Unleashed
Tails 6.0 is based on Debian 12 and includes GNOME 43.
-
KDE Announces New Slimbook V with Plenty of Power and KDE’s Plasma 6
If you're a fan of KDE Plasma, you'll be thrilled to hear they've announced a new Slimbook with an AMD CPU and the latest version of KDE Plasma desktop.
-
Monthly Sponsorship Includes Early Access to elementary OS 8
If you want to get a glimpse of what's in the pipeline for elementary OS 8, just set up a monthly sponsorship to help fund its continued existence.
-
DebConf24 to be Held in South Korea
Busan will be the location of the latest DebConf running July 28 through August 4
-
Fedora Unleashes Atomic Desktops
Fedora has combined its solid distribution with rpm-ostree system to make it possible to deliver a new family of Fedora spins, called Fedora Atomic Desktops.
-
Bootloader Vulnerability Affects Nearly All Linux Distributions
The developers of shim have released a version to fix numerous security flaws, including one that could enable remote control execution of malicious code under certain circumstances.