Free PDF viewers in ASP.net

I have many PDF documents in binary format which is in the SQL Server 2008 database. I have a gridview in my ASP.net page. When a user clicks on any ID column of the record I need to open the pdf in the browser. Are there any free PDF viewer controls out there? How can I convert the binary PDF file and display as PDF in the browser. Thanks

asked Mar 13, 2010 at 17:00 237 2 2 gold badges 5 5 silver badges 12 12 bronze badges

3 Answers 3

Just return the data to the client with a Content-Type of application/pdf . The client will open it in Adobe Reader or whatever PDF viewer is installed.

answered Mar 13, 2010 at 17:05 David Brown David Brown 36.1k 12 12 gold badges 87 87 silver badges 137 137 bronze badges

If you want a consistent experience without wondering how the user's browser will choose to handle the file (i.e. display it inline, launch Acrobat, or try to save it, etc).

(This is a sample I created using their web viewer. They make available zoom, thumbnail and page controls - enough to get around the documents easily)

You will have to make an ASP.NET page that delivers the PDF binary stream, then give Google's viewer the URL of that page.

To stream a PDF through an ASPX page you'll want to Google and search for articles like these :

Basically it's about HTTP and manipulating the MIME type, page headers, etc and writing binary data to the Response stream using available ASP.NET mechanisms.

It might be worthwhile to post a separate question specifically about streaming PDF data through an ASPX page because the current question can be construed as a two-part question or being more oriented toward PDF viewers.