Robert Desprez Communications

  • My Services
  • My Blog
  • About Me
  • Contact Me
You are here: Home / Help Authoring Tools / Controlling page breaks in an EPUB file

Controlling page breaks in an EPUB file

April 5, 2013 by RDesprez 5 Comments

Tweet

New­er Help Author­ing Tools such as Mad­cap Flare or Adobe Robo­Help will quick­ly cre­ate an EPUB file that includes a title page, table of con­tents, and the top­ics that you authored. If you don’t mind open­ing the EPUB file after author­ing it in a Help Author­ing Tool, edit­ing the Cas­cad­ing Style Sheet (CSS), you can gain a lot more con­trol over the for­mat­ting 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 con­trol over page breaks. In March, I spoke about for­mat­ting EPUB files using a CSS at the Writ­er­sUA conference.

A few basics

An EPUB doc­u­ment is a zip file with the .epub exten­sion. EPUB files can be read using e‑reader soft­ware on a myr­i­ad of devices includ­ing the iPad, iPhone, PCs, and smart­phones run­ning on Android.

For tech­ni­cal writ­ers, I believe EPUB files are one of the tech­nolo­gies to watch. The iBooks book­store sells its ebooks in an EPUB file for­mat. With tablets and smart­phones fore­cast to out­sell PCs in the future, users will increas­ing­ly be read­ing content—including tech­ni­cal communications—on these devices.

One of the key advan­tages of an EPUB file is its abil­i­ty to reflow on dif­fer­ent devices.  The fol­low­ing image shows how an EPUB file appears on an iPad:

EPUB file shown on an iPad

The next screen shot shows how the same file appears on an iPhone:

EPUB on an iPhone

In con­trast, a PDF file may look beau­ti­ful on your 24-inch mon­i­tor at home but is dif­fi­cult to read on your smartphone.

Controlling page breaks inside RoboHelp

If you work as a tech­ni­cal com­mu­ni­ca­tor, you prob­a­bly use a Help Author­ing Tool, such as Robo­Help or Mad­cap Flare. These tools pro­vide a lot of the “heavy lift­ing” for you: they cre­ate the title page, a table of con­tents, and the top­ics them­selves. You can use them to con­trol some basic page breaks. But if more con­trol is need­ed, edit your CSS.

Unzipping an EPUB

Com­plete the fol­low­ing steps to unzip your EPUB file: 

  1. Locate your EPUB file.
  2. Change the .epub exten­sion to .zip.
  3. Unzip the con­tents of the folder.
  4. Dou­ble-click the OEBPS fold­er (“OEBPS” stands for Open eBook Pub­li­ca­tion Structure).

  1. Locate the default.css file. This is your CSS file.

Using page breaks

Inside the CSS file add the fol­low­ing code using a text editor:

h2 {

page-break-before: always;           

}

In the CSS, it might appear like the fol­low­ing image:

Changing your CSS to force page breaks

 

This first entry adds a page break before every instance of a head­ing 2. This might be use­ful if you want to insert a page break before a chap­ter title.

Here are some oth­er options to consider:

  • H3 {page-break-before: avoid;} This entry pre­vents an ele­ment (in this case, a heading3) to begin on a new page, unless absolute­ly nec­es­sary. You might want to use this code to try and ensure that con­tent is grouped together.
  • H3 {page-break-after: avoid;} This entry dis­cour­ages a page break after an item.
  • H3 {page-break-inside: avoid} This pre­vents an ele­ment such as a table or long list from being divid­ed by a page-break. Keep in mind that if your table or list spans mul­ti­ple pages, the e‑reader needs to cre­ate a break some­where.

Next steps

After you make changes to the CSS, re-zip the EPUB project, rename so it uses an .epub exten­sion, and test it on all the dif­fer­ent e‑readers that your users may be using. I’ve installed Adobe Dig­i­tal Edi­tions on my com­put­er and iBooks for the iPhone and iPad. Dif­fer­ent e‑readers may ren­der your EPUB file dif­fer­ent­ly so test­ing is vital.

In future blog entries, I’ll explain how to con­trol text align­ment, wid­ows and orphans, and fonts.

Additional resources

EPUB Straight to the Point
by Eliz­a­beth Castro

Cas­tro’s web site on for­mat­ting EPUB files:
http://www.pigsgourdsandwikis.com

 

 

Filed Under: Help Authoring Tools, Online Writing for Mobile, Robert Desprez | Vancouver technical writer | Blog, Technology

Comments

  1. Steve Dayton says

    April 8, 2013 at 3:29 pm

    Thanks for this infor­ma­tion from some­one start­ing to get into the EPUB scene. I appre­ci­ate all the tips and tricks I can get.

    I am con­stant­ly read­ing blan­ket or absolute sound­ing state­ments that a PDF “does not resize”. These kinds of state­ments are not com­plete­ly true. A PDF “can” resize. I have a num­ber of PDFs (my own cre­ations and from oth­er sources) that have been prop­er­ly designed and do in fact resize and reflow text. I can view these PDF on my desk­top, lap­top, iPad (Mini and reg­u­lar), Galaxy Note tablet, and Galaxy SII phone com­fort­ably and with­out any dif­fi­cul­ty. I even get images and page num­bers and I can add all kinds of com­ments and markups such as under­lines, high­lights, text box­es, notes and hand drawn dia­grams and arrows. It is true that iPhone users using at least the Adobe Read­er for mobile don’t have the abil­i­ty to reflow text which makes read­ing a PDF “dif­fi­cult and tedious”. How­ev­er the text in a prop­er­ly designed and cre­at­ed PDF viewed on my Android phone reflows and with a pinch of the fin­gers can resize up or down. Should I wish to print the PDF or a por­tion of the PDF I can on my desk­top print­er retain­ing its print layout.

    Hav­ing said that I don’t believe in PDF over EPUB or EPUB over PDF and any oth­er for­mat the future holds in store.

    Reply
  2. RDesprez says

    April 11, 2013 at 3:20 am

    Hi Steve,

    I agree that read­ing 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 for­mat, Acro­bat Read­er dis­plays that page as the author intend­ed. It does­n’t change from device to device. In some cas­es, hav­ing a sta­ble and some­what pre­dictable expe­ri­ence is what you want.

    In con­trast, pages writ­ten in an EPUB file def­i­nite­ly change from device to device. The EPUB file attempts to opti­mize its pre­sen­ta­tion, based on the device you are using.

    Thanks for your comment.

    Robert

    Reply
    • Steve Dayton says

      April 13, 2013 at 6:10 am

      EPUB files can reflow. I have a num­ber of PDFs to prove it. Some that oth­ers have cre­at­ed and some that I have cre­at­ed. My point is that to say PDFs don’t reflow or resize isn’t entire­ly true. As I stat­ed ear­li­er the PDF has to be designed and cre­at­ed so it will reflow. Mind you, reflow only works so far with Adobe Read­er for Android. There may be oth­er read­ers out there that can do the same I don’t know.

      Please under­stand that I am not favor­ing PDF over EPUB when it comes to the greater good of user expe­ri­ence. For the most part EPUB trumps PDF, as you say.

      Reply
      • RDesprez says

        April 15, 2013 at 3:27 am

        Hi Steve,

        I don’t have an Android smart­phone so I’ll take your word that PDFs can reflow on that device. I agree that PDFs can be resized. 

        Thanks for clarifying.

        Robert

        Reply

Trackbacks

  1. Helpful Technical Tips on Formatting Page Breaks, etc. into ePub Documents – Federation of BC Writers says:
    December 25, 2019 at 7:58 pm

    […] It’s always a chal­lenge to take on the for­mat­ting aspects of an ebook. For a lot of authors, once we’ve writ­ten the book, it’s nice to hand it over to a tech­ni­cal expert to for­mat and upload it onto Ama­zon, or wher­ev­er it’s going, but for those of us feel­ing brave enough to take on our own for­mat­ting, help exists. This is one of the blogs I turn to to walk me though it all: https://robertdesprez.com/2013/04/05/controlling-page-breaks-in-an-epub-file/ […]

    Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

About Robert Desprez

I have worked as a Vancouver technical writer for more than 20 years, working at some of British Columbia's largest high-tech firms. I have served in leadership positions for the Society for Technical Communication and have worked as a writing instructor at Vancouver's Simon Fraser University.

Robert Desprez Follow 1,144 237

Vancouver Technical Writer. Former Instructor at Simon Fraser University. Dog Lover. Coffee Drinker. Tennis and Piano Player.

robert_desprez
robert_desprez avatar; Robert Desprez @robert_desprez ·
2 May 1918126029463536113

This productivity poison is exhausting you /via @globeandmail

This productivity poison is exhausting you

Constantly shifting your attention undermines what is your super power in most knowledge jobs. How you anticipate an...

www.theglobeandmail.com

Reply on Twitter 1918126029463536113 Retweet on Twitter 1918126029463536113 0 Like on Twitter 1918126029463536113 0 Twitter 1918126029463536113
robert_desprez avatar; Robert Desprez @robert_desprez ·
24 Apr 1915491435350253736

Google forcing some remote workers to come back 3 days a week or lose their jobs

Image for twitter card

Google forcing some remote workers to come back 3 days a week or lose their jobs

Several units within Google have told remote staffers that their roles may be at risk if they don't start showin...

cnb.cx

Reply on Twitter 1915491435350253736 Retweet on Twitter 1915491435350253736 0 Like on Twitter 1915491435350253736 0 Twitter 1915491435350253736
robert_desprez avatar; Robert Desprez @robert_desprez ·
16 Apr 1912364221582758283

Image for twitter card

As Canadians cancel trips due to Trump, the U.S. tourism industry could lose billions

The Trump administration's attacks on its northern neighbor have been met with confusion and anger by some Canadians...

www.npr.org

Reply on Twitter 1912364221582758283 Retweet on Twitter 1912364221582758283 0 Like on Twitter 1912364221582758283 0 Twitter 1912364221582758283
robert_desprez avatar; Robert Desprez @robert_desprez ·
13 Apr 1911507080504303659

Image for twitter card

How to awaken Canada’s sleeping economic giant

Recent interviews with industry leaders and experts point toward 10 areas where actionable strategies are needed – ...

www.theglobeandmail.com

Reply on Twitter 1911507080504303659 Retweet on Twitter 1911507080504303659 0 Like on Twitter 1911507080504303659 0 Twitter 1911507080504303659
Load More

Recent Blog Posts

  • ChatGPT: The AI-Powered Proofreader
  • Four Ways Confluence Could Be Better
  • First impressions of MadCap’s purchase of IXIASOFT
  • Online Conferences for Technical Writers in 2023

About Me

Robert Desprez I have worked as a Vancouver technical writer for more than 20 years, working at Kodak, Boeing, Teck Resources, and FortisBC. In addition, I have worked as a writing instructor at Simon Fraser University in Vancouver.

Contact Me

Robert Desprez Com­mu­ni­ca­tions Inc.
North Van­cou­ver, British Columbia
Canada
Phone: 604–836-4290

  • Email
  • LinkedIn
  • Twitter

Copyright © 2025  · Robert Desprez Communications Inc.