Click here to Skip to main content
15,611,074 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:

how to view pdf file in browser?

There are some nice browsers' plug-ins for this purpose. (I don't think that Adobe's one is one of them, but also usable :-).) So, first of all, I would suggest you simply rely on client-side software on this. This would be more than reasonable. Even if browser does not support PDF (which easily can happen), all browsers will suggest to either save the PDF file or open with some default viewer. Event if no viewers are available, the user will be able to save the file and take care about the viewers later. Event this would not be a great burden for the user, because such viewers are easily accessible.

Of course, you cannot assume that the PDF will be shown in the browser in all cases. If you really want to show it in all cases, you would need to develop some mapping of PDF to HTML and implement creation of the HTML content from PDF on the fly, one the server side, while your ASP.NET code is preparing the HTTP response. This is a pretty difficult and pretty big work. First of all, the problem of creation of mapping would be ambiguous. Why? Because HTML and PDF have very different concepts: HTML is generally fluid, but PDF is totally rigid; this is a kind of "electronic paper", pretty much like a printout. Besides, PDF is pretty much unstructured (pretty much like printout), in comparison with HTML. Overall, this is doable, but I won't encourage you in going into this.

Share this answer
This has worked for me in a number of instances. Good luck.

Must have Adobe Reader installed.

Open Adobe Reader, go to: 'Edit' > 'Preferences' > 'General' > "Select Default PDF Handler", in the drop-down, select the correct Reader Handler by version (should only be one, it may already be selected, reselect anyway).

The software will implement this change and then request a reboot.
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