Any idea how to implement 'page break' in epub reader? .epub is nothing but HTML pages, and epub reader renders those html pages. but i wonder how some epub readers like Adobe Digital Edition implemented page break. There,when we jump to any page, you will not find half displayed line(i.e only upper part of the letters visible and lower part will be in the next page) or half images where the other part in the next page. How to push the line to next page if i cannot display it completely in the current page?
EPUB doesn't really have a concept of pages-- it's meant for reflowable content that flows to fit the dimensions of the display container. So what you're suggesting is a bit of a hack.
That said, users are comfortable with pages, and most readers implement some concept of a page.
What you will need is to implement something like Knuth's page-breaking algorithm, which in turn depends upon his paragraph, and line breaking algorithms. See his TeX book for the full literate code (IIRC, it's in Pascal). (It's not that complex a piece of code-- I implemented one in a desktop publishing program I wrote many years back).
If you went this route, it means you probably couldn't use a UIWebView.
BTW, Adobe Digital Edition implements a variation of Knuth's algorithm.
In the underlying html, you can put something like this:
<span style="page-break-after: always" />
EPUB doesn't really have a concept of pages-- it's meant for reflowable content that flows to fit the dimensions of the display container. So what you're suggesting is a bit of a hack.
That said, users are comfortable with pages, and most readers implement some concept of a page.
What you will need is to implement something like Knuth's page-breaking algorithm, which in turn depends upon his paragraph, and line breaking algorithms. See his TeX book for the full literate code (IIRC, it's in Pascal). (It's not that complex a piece of code-- I implemented one in a desktop publishing program I wrote many years back).
If you went this route, it means you probably couldn't use a UIWebView.
BTW, Adobe Digital Edition implements a variation of Knuth's algorithm.
© 2022 - 2024 — McMap. All rights reserved.