Newer Help Authoring Tools such as Madcap Flare or Adobe RoboHelp will quickly create an EPUB file that includes a title page, table of contents, and the topics that you authored. If you don’t mind opening the EPUB file after authoring it in a Help Authoring Tool, editing the Cascading Style Sheet (CSS), you can gain a lot more control over the formatting of the file.
In this blog entry, I’ll briefly explain how to unzip the EPUB file and edit the CSS so that you gain more control over page breaks. In March, I spoke about formatting EPUB files using a CSS at the WritersUA conference.
A few basics
An EPUB document is a zip file with the .epub extension. EPUB files can be read using e‑reader software on a myriad of devices including the iPad, iPhone, PCs, and smartphones running on Android.
For technical writers, I believe EPUB files are one of the technologies to watch. The iBooks bookstore sells its ebooks in an EPUB file format. With tablets and smartphones forecast to outsell PCs in the future, users will increasingly be reading content—including technical communications—on these devices.
One of the key advantages of an EPUB file is its ability to reflow on different devices. The following image shows how an EPUB file appears on an iPad:
The next screen shot shows how the same file appears on an iPhone:
In contrast, a PDF file may look beautiful on your 24-inch monitor at home but is difficult to read on your smartphone.
Controlling page breaks inside RoboHelp
If you work as a technical communicator, you probably use a Help Authoring Tool, such as RoboHelp or Madcap Flare. These tools provide a lot of the “heavy lifting” for you: they create the title page, a table of contents, and the topics themselves. You can use them to control some basic page breaks. But if more control is needed, edit your CSS.
Unzipping an EPUB
Complete the following steps to unzip your EPUB file:
- Locate your EPUB file.
- Change the .epub extension to .zip.
- Unzip the contents of the folder.
- Double-click the OEBPS folder (“OEBPS” stands for Open eBook Publication Structure).
- Locate the default.css file. This is your CSS file.
Using page breaks
Inside the CSS file add the following code using a text editor:
h2 {
page-break-before: always;
}
In the CSS, it might appear like the following image:
This first entry adds a page break before every instance of a heading 2. This might be useful if you want to insert a page break before a chapter title.
Here are some other options to consider:
- H3 {page-break-before: avoid;} This entry prevents an element (in this case, a heading3) to begin on a new page, unless absolutely necessary. You might want to use this code to try and ensure that content is grouped together.
- H3 {page-break-after: avoid;} This entry discourages a page break after an item.
- H3 {page-break-inside: avoid} This prevents an element such as a table or long list from being divided by a page-break. Keep in mind that if your table or list spans multiple pages, the e‑reader needs to create a break somewhere.
Next steps
After you make changes to the CSS, re-zip the EPUB project, rename so it uses an .epub extension, and test it on all the different e‑readers that your users may be using. I’ve installed Adobe Digital Editions on my computer and iBooks for the iPhone and iPad. Different e‑readers may render your EPUB file differently so testing is vital.
In future blog entries, I’ll explain how to control text alignment, widows and orphans, and fonts.
Additional resources
EPUB Straight to the Point
by Elizabeth Castro
Castro’s web site on formatting EPUB files:
http://www.pigsgourdsandwikis.com
Steve Dayton says
Thanks for this information from someone starting to get into the EPUB scene. I appreciate all the tips and tricks I can get.
I am constantly reading blanket or absolute sounding statements that a PDF “does not resize”. These kinds of statements are not completely true. A PDF “can” resize. I have a number of PDFs (my own creations and from other sources) that have been properly designed and do in fact resize and reflow text. I can view these PDF on my desktop, laptop, iPad (Mini and regular), Galaxy Note tablet, and Galaxy SII phone comfortably and without any difficulty. I even get images and page numbers and I can add all kinds of comments and markups such as underlines, highlights, text boxes, notes and hand drawn diagrams and arrows. It is true that iPhone users using at least the Adobe Reader for mobile don’t have the ability to reflow text which makes reading a PDF “difficult and tedious”. However the text in a properly designed and created PDF viewed on my Android phone reflows and with a pinch of the fingers can resize up or down. Should I wish to print the PDF or a portion of the PDF I can on my desktop printer retaining its print layout.
Having said that I don’t believe in PDF over EPUB or EPUB over PDF and any other format the future holds in store.
RDesprez says
Hi Steve,
I agree that reading some PDFs are fine on mobile devices. But as far as I know, PDFs don’t reflow. If an author designs a page in a PDF format, Acrobat Reader displays that page as the author intended. It doesn’t change from device to device. In some cases, having a stable and somewhat predictable experience is what you want.
In contrast, pages written in an EPUB file definitely change from device to device. The EPUB file attempts to optimize its presentation, based on the device you are using.
Thanks for your comment.
Robert
Steve Dayton says
EPUB files can reflow. I have a number of PDFs to prove it. Some that others have created and some that I have created. My point is that to say PDFs don’t reflow or resize isn’t entirely true. As I stated earlier the PDF has to be designed and created so it will reflow. Mind you, reflow only works so far with Adobe Reader for Android. There may be other readers out there that can do the same I don’t know.
Please understand that I am not favoring PDF over EPUB when it comes to the greater good of user experience. For the most part EPUB trumps PDF, as you say.
RDesprez says
Hi Steve,
I don’t have an Android smartphone so I’ll take your word that PDFs can reflow on that device. I agree that PDFs can be resized.
Thanks for clarifying.
Robert