实现在线阅读 [英] implement online reading

查看:76
本文介绍了实现在线阅读的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

hi
i希望在我的网站上实现在线阅读。

i有pdf文件显示

请帮助我,我该如何实现它。



这有点像谷歌在线阅读书籍

解决方案

PDF经常用于阅读,但它是不太适合,因为它相当于文件的硬纸副本。在过去几年中,电子书和浏览器阅读都得到了大量的开发和改进,因此PDF为样本表提供了诸如epub,HTML和XML等类型的文档。现在,只有两个最后的选项与通过浏览器,一些网站或本地读取相关,这没关系。



当涉及到Web开发时,PDF真的是偏离主题的。你无能为力,也无需做任何事。这不是W3标准的一部分。如果您在浏览器中阅读了一些PDF文档,它与Web开发无关,也不会受到Web站点开发的影响。这是由一个或另一个浏览器插件完成的。当您进行Web开发时,您不应该做出任何假设,即用户可以以任何方式阅读PDF。整个客户端系统可能没有任何东西可以支持PDF(这是一种非常罕见的情况,但在现实生活中它会发生)。这是你需要假设的。在这种情况下,浏览器将提供将PDF文件保存在本地文件系统中,并且用户可能没有任何东西可以读取它。它永远不会被认为是一个问题,因为用户可以随时使用另一个系统或下载一个现成的读者并稍后阅读。



所以,如果你还是想用PDF阅读,你什么都不应该做。提供PDF内容并让用户选择如何处理它。如果你想提供HTML或XML阅读,并希望实现一些特色便利阅读,我们可以讨论它。



-SA


CHITRAKSH写道:


ok先生

请指导我提供HTML或XML阅读,并希望实现一些特色促进阅读...

这不是一件简单的事情,所以我只能给你一些想法。如果你认真对待它,它可能是一项相当大的工作;而且我不确定你处理这一切是否合理。



我会尝试从更琐碎的事情开始更先进。



首先,您可以使用HTML提供文档,并使用CSS设置样式以使书籍文档适合阅读。问题是对于高规模库来说,这种方法对于 ad hoc 来说有点太多了。 HTML允许很多样式;并且没有任何内容强制文档布局的作者统一它们。不同的书籍需要不同的布局,这需要大量的手工工作。我希望你明白,作者写的或目前在网上提供的文字是 en mass 布局很差。很少有作者使用正确的破折号,引用,布局对话框和标题,最遗憾的是,使用索引,TOC,注释和引用等项目。最悲伤的问题是脚注这样的特征。 HTML本身不强制执行任何操作,例如,没有任何内容检查引用TOC或引用项的锚点是否与项目本身的锚点匹配,导航到引用允许在正确的位置快速返回主文本。



使用XML和XSLT可以实现一些此类功能: https:// en。 wikipedia.org/wiki/XSLT [ ^ ]。



这种方法可以将文档整形为XML,可以针对某些XML模式进行正式验证: https://en.wikipedia.org/wiki/XML_Schema_%28W3C%29 [ ^ ]。



在这种情况下,用户仍然会读取HTML,但是这个HTML是从XML自动生成的。它将允许严重程度的文本统一和自动检查其结构的有效性。同时,使用XSLT从XML生成HTML可能会有问题,因为纯粹声明性语言的强大功能是有限的,因为XSLT相对难以调试。例如,您不能实现动态创建单独的HTML元素(例如,单独的TOC和/或脚注引用),动态更改演示文稿选项等功能。



下一级可以在JavaScript或服务器端技术(PHP只是其中之一)或两者的某种组合的基础上实现。在这种情况下,您将使用命令式语言,这些语言易于调试,并且可以实现更多功能,例如上面提到的功能。



目前,我建议使用一种基于XML的可用标准。这是一个名为EPUB的免费开放式电子书标准: https://en.wikipedia.org/wiki/EPUB [ ^ ]。



首先,在过去几年中,越来越多的书籍出现在这个标准中;读者和创作工具正在兴起并正在得到改进。因此,第一个好处是:您可以随时使用一些可用的阅读器并离线预览该书。这也是在书上测试您的Web阅读器功能的机会;您还可以使用可用的创作工具轻松创建一些教科书。标准本身的功能集是最全面的。



最后,您可以尝试找到一些可在您的网站上使用的可用实现。我从未见过,但你可以试试。无论如何,我发现了一些这样的实现: http://bfy.tw/Vcu [ ^ ]。



-SA

hi i want to implement online reading in my website.
i have pdf files to be shown
please help me ,how can i implement it.

this is somethiing like google online read book

解决方案

PDF is often used for reading, but it is poorly suitable for that, because it is rather a hard paper copy of document. During last years, both e-books and reading through browser got a lot of development and improvements, so PDF gives place for such types of documents as epub, HTML and XML with style sheets. Now, only two last options are relevant to the reading through the browser, off some Web site or locally, it doesn't matter.

When it comes to Web development, PDF is really off-topic. There is nothing you can or need to do about it. This is not a part of W3 standard. If you read some PDF document in the browser, it has nothing to do with Web development and is not something you can affect by Web site development. This is done by one or another browser plug-in. When you do Web development, you should never make any assumptions that a user can read PDF in any way. It's possible that the whole client system has nothing to support PDF (this is a pretty rare situation, but in real life it happens). This is what you need to assume. In such cases, the browser will offer saving the PDF file in a local file system, and the user may not have anything to read it. It is never considered as a problem, because a user can always use another system or download one of the readily available readers and read it later.

So, if you still want to use PDF for reading, there is nothing you should do. Provide PDF content and let the user choose what to do with it. And if you want to provide HTML or XML for reading and want to implement some featured facilitating reading, we could discuss it.

—SA


CHITRAKSH wrote:

ok sir
please guide me about "to provide HTML or XML for reading and want to implement some featured facilitating reading…"

This is not a simple thing, so I can only give you some ideas. If you take it seriously, it can be quite a big work; and I'm not sure it makes sense for your to deal with all that.

I'll try to start with trivial things to more advanced.

First of all, you can provide document in HTML and just style it using CSS to make the book document suitable for reading. The problem is that this approach would be a bit too much of ad hoc for a high-scale library. HTML allows many styles; and nothing enforce the authors of the document layouts to unify them. Different books would require different layouts, and it would require a lot of manual work. I hope you understand that the text written by authors or presently available on the Web are en mass very poorly laid out. Very few authors use proper dash, quotation makes, layout dialogs and captions, and, most sadly, such items as index, TOC, notes and references. The most sorrowful problem is such feature as footnotes. HTML itself does not enforce anything, for example, nothing checks that the anchors referencing the TOC or reference items matches the anchors at the items themselves, that navigating to a reference allows to quickly return to the main text at right point.

Some of such features can be implemented using XML with XSLT: https://en.wikipedia.org/wiki/XSLT[^].

This approach would allow to shape the document as XML which can be formally validated against some XML schema: https://en.wikipedia.org/wiki/XML_Schema_%28W3C%29[^].

In this case, the user still reads HTML, but this HTML is automatically generated from XML. It would allow serious degree of unification of text and automatic check up of the validity of their structure. At the same, the, generation HTML from XML with XSLT can be problematic, because the power of a purely declarative languages is limited and because XSLT is relatively hard to debug. You cannot, for example, implement such features as creating of separate HTML elements dynamically (separate div for TOC and/or references of footnotes, for example), change presentation options dynamically, and so on.

Next level could be achieved on the base of JavaScript, or server-side technology (PHP is only one of them), or some combination of both. In this case, you would use imperative languages, which are easy for debugging and can implement a lot more features, such as those mentioned above.

At this time, I would recommend using one available standard based on XML. This is the free and open e-book standard called EPUB: https://en.wikipedia.org/wiki/EPUB[^].

First of all, during last years, more and more books laid out in this standard are emerging; and the readers and authoring tools are emerging and are being improved. So, the first benefits is: you can always use some available readers and preview the book off-line. This is also the opportunity to test your Web reader functionality on the books; you can also easily create some text books using available authoring tools. The feature set of the standard itself is the most comprehensive.

And finally, you can try to find some available implementation which you can use on your site. I never saw any, but you can try. Anyway, I found a number of such implementations: http://bfy.tw/Vcu[^].

—SA


这篇关于实现在线阅读的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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