tags:

views:

423

answers:

1

It's really interesting how book reading applications like Stanza or Eucalyptus split epubs which is html by page so lines are clear and next page starts at the correct line. Does anyone has any idea how this could be accomplished?

+2  A: 

The easiest way is to render a chapter inside an epub in a UIWebView and the use javascript to compute page boundaries. The interface between Cocoa and JS is kind of tricky but stringByEvaluatingJavaScriptFromString: can be used to run JS inside a UIWebView.

Once you have the page boundaries you can scroll the chapter using window.scrollTo(x,y); and adjust the size of your UIWebView according to your page boundaries to prevent any incomplete lines showing from the bottom.

Engin Kurutepe
yes you can use stringByEvaluatingJavaScriptFromString to work with Javascripts in UiWebview. And since you ePub extracts HTML files per page then you can have functions in javascripts to do inserting paginations with parameters from your Objective-C. But it depends, if your using swipe then you could just put counter. If all page are in one uiwebview page then you can use window.scrollTo(x,y).
ZaldzBugz