w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Prevent Orphan Lines in ePub export through Pages

Do you really mean "line breaks", not "page breaks"?

The only completely reliable way to enforce page breaks is to prepare separate XHTML files.

Beyond that, you're on your own. You've entered "iOS as the new IE6" hell. You'll find people telling you to put a page-break-before on the header tag, or page-break-after on the last bit of the previous page, or wrap everything to go one page in a block with the property display: inline-block. Any or all of these might or might not work depending on the reader, its version, or the time of day, and they might not work now and start working magically in the future, or work now and stop working magically in the future. My suggestion is to stop trying to reverse-engineer iBooks to see what works or doesn't, and just go to separate XHTML files.

Depending on your needs and skill level, you can write XSL-based tools which split apart XHTML files into separate files (perhaps based on a custom attribute such as myns:page-break='yes') to ensure you get those page breaks where you want them.

I strongly recommend against manual insertion of page-break-* properties to handle orphans. At some point, ebook readers will support the CSS orphans property. Until then, it's a fools errand. If you are so intent on obtaining the precise layout you want, you'll need to go to fixed-layout.

© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.