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
-
Fedora 41 Beta Available with Some Interesting Additions
If you're a Fedora fan, you'll be excited to hear the beta version of the latest release is now available for testing and includes plenty of updates.
-
AlmaLinux Unveils New Hardware Certification Process
The AlmaLinux Hardware Certification Program run by the Certification Special Interest Group (SIG) aims to ensure seamless compatibility between AlmaLinux and a wide range of hardware configurations.
-
Wind River Introduces eLxr Pro Linux Solution
eLxr Pro offers an end-to-end Linux solution backed by expert commercial support.
-
Juno Tab 3 Launches with Ubuntu 24.04
Anyone looking for a full-blown Linux tablet need look no further. Juno has released the Tab 3.
-
New KDE Slimbook Plasma Available for Preorder
Powered by an AMD Ryzen CPU, the latest KDE Slimbook laptop is powerful enough for local AI tasks.
-
Rhino Linux Announces Latest "Quick Update"
If you prefer your Linux distribution to be of the rolling type, Rhino Linux delivers a beautiful and reliable experience.
-
Plasma Desktop Will Soon Ask for Donations
The next iteration of Plasma has reached the soft feature freeze for the 6.2 version and includes a feature that could be divisive.
-
Linux Market Share Hits New High
For the first time, the Linux market share has reached a new high for desktops, and the trend looks like it will continue.
-
LibreOffice 24.8 Delivers New Features
LibreOffice is often considered the de facto standard office suite for the Linux operating system.
-
Deepin 23 Offers Wayland Support and New AI Tool
Deepin has been considered one of the most beautiful desktop operating systems for a long time and the arrival of version 23 has bolstered that reputation.