如何在epub reader中实现'分页符' [英] how to implement 'page break' in epub reader

查看:986
本文介绍了如何在epub reader中实现'分页符'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

任何想法如何在epub reader中实现'分页符'?
.epub只是HTML页面,而epub阅读器则呈现这些html页面。
但我想知道一些epub读者如Adobe Digital Edition如何实现分页。
在那里,当我们跳转到任何页面时,你将不会发现半个显示行(即只有字母的上半部分可见,下半部分在下一个页面)或半个图像,其他部分在下一页。
如何将该行推送到下一页,如果我无法在当前页面中完全显示它?

解决方案

EPUB doesn真的没有页面的概念 - 它是为了适应显示容器的尺寸而流动的可回流内容。所以,你所建议的是一些黑客行为。

也就是说,用户对页面很满意,大多数读者实现了页面的一些概念。 >

你需要的是实现Knuth的分页算法,而这个算法又取决于他的段落和分行算法。查看他的TeX书中的完整识字代码(IIRC,它在帕斯卡​​尔)。 (这不是一段复杂的代码 - 我在多年前写过的桌面出版程序中实现了一个)。



如果你走这条路线,这意味着你可能无法使用UIWebView。



顺带一提,Adobe Digital Edition实现了Knuth算法的变体。


Any idea how to implement 'page break' in epub reader? .epub is nothing but HTML pages, and epub reader renders those html pages. but i wonder how some epub readers like Adobe Digital Edition implemented page break. There,when we jump to any page, you will not find half displayed line(i.e only upper part of the letters visible and lower part will be in the next page) or half images where the other part in the next page. How to push the line to next page if i cannot display it completely in the current page?

解决方案

EPUB doesn't really have a concept of pages-- it's meant for reflowable content that flows to fit the dimensions of the display container. So what you're suggesting is a bit of a hack.

That said, users are comfortable with pages, and most readers implement some concept of a page.

What you will need is to implement something like Knuth's page-breaking algorithm, which in turn depends upon his paragraph, and line breaking algorithms. See his TeX book for the full literate code (IIRC, it's in Pascal). (It's not that complex a piece of code-- I implemented one in a desktop publishing program I wrote many years back).

If you went this route, it means you probably couldn't use a UIWebView.

BTW, Adobe Digital Edition implements a variation of Knuth's algorithm.

这篇关于如何在epub reader中实现'分页符'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆