Reputation: 954
I am loading files from an .epub
into UIWebView
s for display. At the moment, the .epub
is divided into individual files for each chapter. To display the chapters, I am just loading these files into UIWebView
. I am trying to figure out how to break these down into pages depending on font size, styling, etc. It's proving difficult, as iOS only accesses the UIWebView
content indirectly. Is there a standard method for breaking it up?
I'm thinking about grabbing full chapter content out of a page with JS, then breaking each chapter down into pages based on line length and lines per page, but that seems sort of crazy, and I'm having trouble returning it to a UIWebView
as valid html or javascript code. (The text contains single quotes, etc.)
Upvotes: 3
Views: 1514
Reputation: 2171
Use UIWebView Pagination :)
myWebView.paginationMode = UIWebPaginationModeLeftToRight;
myWebView.paginationBreakingMode = UIWebPaginationBreakingModePage;
myWebView.gapBetweenPages = 50;
For font scaling, you need to inject css thru javascript for webkit's font scaling property
http://css-infos.net/property/-webkit-text-size-adjust
Upvotes: 1