Present html content as dynamic “pages”

前端 未结 3 1705

I\'m building an e-Book reader for android. The content of an ebook is often divided into html files (epub) with one or may chapters in them.

I\'m planning to build an e

3条回答
  •  挽巷
    挽巷 (楼主)
    2021-02-08 07:53

    Maybe you can do it like this

    • Text is being added and rendered inside WebView

    • In WebView, you can use Javascript to inspect the current state of DOM tree and extract measurements like width and height of individual elements

    • Javascript communicates back the size of the page back to WebView creator thru some callback

    • When Javascript detects that the page size threshold is exceeded it sends a signal for a page break needed

    Android HTML5 Kindle does page breaking with Javascript so it is definitely possible.

提交回复
热议问题