I have a web app that needs to be able to display a PDF. It needs to allow the user to page through the PDF, and my application needs to be able to know which page is currently being viewed, because other aspects of the web app will change based on the current page. Ideally it would not be dependent on the client having Adobe Reader but I could probably support that dependency.

What are my best options for this? My application stack consists of ASP.NET 4 along with optionally Silverlight 5. Also, I could use something that is client-side based as well using JavaScript / HTML if such a thing exists.

I found ComponentOne's offering for this and that seems like the leading candidate at this point, but I want to know if there are other options I should consider.

Edit: Per Fosco's comment, converting the PDF to another format (such as HTML) might be an option, as long as I could tie back parts of the converted document to the original PDF page #s.

Another note: this has to run entirely on our servers. It would not be acceptable to use a third-party service to view the PDFs.

closed as not constructive by gnat, user53019, Kilian Foth, Dynamic, user40980 Jun 25 '13 at 14:18

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. If this question can be reworded to fit the rules in the help center, please edit the question.

  • With all of the browser/plug-in considerations you might also want to investigate on-the-fly conversion from PDF to HTML. – Fosco Sep 8 '11 at 14:25
  • @Fosco, if there is a good library for that I would definitely take a look at it. Do you have any recommendations? It would only be useful if post-conversion I could tie back particular parts of the HTML doc to specific page #s from the PDF. – RationalGeek Sep 8 '11 at 14:27
  • Considering that everyone already has a PDF viewer on their desktop, this seems rather silly. Why not just download the PDF and be done with it? – S.Lott Sep 8 '11 at 14:33
  • @S.Lott because the web application stores metadata about the PDF on a per-page basis, and the user interacts with the web application to affect that metadata based on the current page that the user is looking at. I could script all this on the client side I imagine using Adobe Reader but I'd prefer to have this all running in a web app. – RationalGeek Sep 8 '11 at 14:49
  • @S.Lott - Everyone has a PDF reader, apart from those that don't. – uɐɪ Sep 8 '11 at 15:09

My suspicion is that if you want to keep track of the page, and do other things, you'll have to get away from PDF in the browser. Based on what you've said, probably the easiest solution will be to extract pages from the PDF as images (perhaps preprocess the PDFs and store each page image separately), then use a Silverlight control to show the pages one by one. A possible starting place is this codeproject sample. According to some other StackOverflow answers, it is not possible to do this with iText.

  • This is definitely one of the design options I am considering. Thanks for the sample link. – RationalGeek Sep 8 '11 at 16:47

There's been a lot of buzz around pdf.js recently, a javascript PDF renderer for html 5.

It is a very young project, it is not yet suitable for real world usage, and it requires a recent browser. But in a long term, that may be a viable solution for your problem.


pdf.js is now integrated into Firefox as the default built in PDF viewer.

  • 1
    Interesting link barjak. I agree long term this library might be interesting but it is too immature at this point. But this is definitely the type of thing I'm looking for. – RationalGeek Sep 8 '11 at 15:01

PDF.JS is not exactly a plug and play operation, you're better off converting the PDFs to HTML. There's also things you can pay for.

What I reccomend to anyone looking to embed a PDF in a webpage with minimal configuarion is Google Docs Viewer.

Advantage: Easy like Sunday Morning, beautiful
Disadvantage: Hosted by Google

Not the answer you're looking for? Browse other questions tagged or ask your own question.