Load epub when changing font

I use an e-book reader application such as iBooks. I have successfully read the .epub file. But my problem is: -

I need to add font size and size reduction and font change functionality. I have to adjust the pages when I increase and decrease the font size. How can I split the HTML string on the pages ?.

You can see in both images. After changing the font size, the html string is split and formatting crashes.

Thanks in advance

enter image description hereenter image description here

+4
source share
3 answers

Finally, I got an answer. It is very simple. In ios 7 you do not need to write javascript for pagination or any logic.

UIWebview. .

self.webView.paginationMode = UIWebPaginationModeLeftToRight;
self.webView.paginationBreakingMode = UIWebPaginationBreakingModePage;
self.webView.scrollView.delegate = self;
self.webView.scrollView.pagingEnabled = YES;
self.webView.scrollView.alwaysBounceHorizontal = YES;
self.webView.scrollView.alwaysBounceVertical = NO;
self.webView.scrollView.bounces = YES;

a: https://github.com/kalpesh22m/Epub-Reader-With-Pegination

+2

, ...

, HTML- : . "", .

  • $num_words = 100
  • $num_words = > $first_page_html;
  • $first_page_html UIWebView "" (. ).
  • UIWebView. ? , .
  • UIWebView, $num_words -;
  • do $num_words ++;
  • GOTO 2

, - . :

, - . , $num_words 100, 99, 98, 97, 96,..., 62, 100, 80, 60, 70, 65, 64, 63, 62. - , . - 30% , , (1-1/(1 + 30%)) = 23%, , , 0,77 .

, .

UIWebView, webView.scrollView.contentSize.height. , , UIWebView , .

HTML, -stringByEvaluatingJavaScriptFromString: UIWebView, , . , - .

: "" -loadHTMLString:baseURL:, -webViewDidFinishLoad:.

, ( ) Javascript - , , .

+3

, , em. em : 62,5%, div , , 1.2em ( 12px). , Div, 10%. , , . column css, css . . HTML

js

<a href="http://jsfiddle.net/hJ6Mj/4/">Js Fiddle</a>

. "readium js for chrome". , epub

+1

Source: https://habr.com/ru/post/1535487/


All Articles