Click here to Skip to main content
15,792,335 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
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
Mehdi Gholam 24-Jun-15 1:56am    
Chrome and firefox now have pdf viewers built in.
CHITRAKSH 2010 24-Jun-15 1:58am    
no i want customization in my online reading like, disable/enable download etc.
please guide .

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.

Share this answer
CHITRAKSH 2010 25-Jun-15 1:25am    
ok sir
please guide me about ".. to provide HTML or XML for reading and want to implement some featured facilitating reading....."
Sergey Alexandrovich Kryukov 25-Jun-15 2:22am    
It's a big question. I tried to answer with some of my ideas on the topic in Solution 2.
Now, are you going to accept my answers formally? In all cases, your follow-up questions will be welcome.
CHITRAKSH 2010 25-Jun-15 1:27am    
i understand that pdf is not good choice, so kindly tell me about online reading using HTML/XML.

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:[^].

This approach would allow to shape the document as XML which can be formally validated against some XML schema:[^].

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:[^].

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:[^].

Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900