HTML book-like pagination

后端 未结 10 1381
清歌不尽
清歌不尽 2020-11-27 09:29

How can I split the content of a HTML file in screen-sized chunks to \"paginate\" it in a WebKit browser?

Each \"page\" should show a complete amount of text. This

10条回答
  •  栀梦
    栀梦 (楼主)
    2020-11-27 10:08

    Maybe it would work to use XSL-FO. This seems heavy for a mobile device, and maybe it's overkill, but it should work, and you wouldn't have to implement the complexities of good pagination (e.g. how do you make sure that each screen doesn't cut text in half) yourself.

    The basic idea would be:

    • transform the XHTML (and other EPUB stuff) to XSL-FO using XSLT.
    • use an XSL-FO processor to render the XSL-FO into a paged format that you can display on the mobile device, such as PDF (can you display that?)

    I don't know whether there is an XSL-FO processor available for Android. You could try Apache FOP. RenderX (XSL-FO processor) has the advantage of having a paged-HTML output option, but again I don't know if it could run on Android.

提交回复
热议问题