I have a web app that needs to be able to display a PDF. It needs to allow the u
ID: 650205 • Letter: I
Question
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.
Explanation / Answer
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.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.