tags:

views:

44

answers:

4

Can someone point me to some code/tutorial on how to upload pdf files and store them, then moreover how to use a pdf reader to display the file as read only in an asp.net application.

Is there a PDF reader already in the visual studio toolbox?

A: 

Uploading a PDF is just like any other file. Use the ASP.NET file uploader control:

http://www.codeproject.com/KB/aspnet/fileupload.aspx

In order to view the PDF in an ASP.NET application, you could either depend on Acrobat being there or use a PDF Viewer control.

The company I work for, Atalasoft, sells a PDF Reader add-on to our web viewer controls. You can learn more here: http://www.atalasoft.com/products/dotimage/pdf-reader

Lou Franco
A: 

Adobe provides (on acrobat.com) a free service which provides you with the ability to upload pdf (and also other types like doc...) and then embed a nice flash interface for displaying the files on your page.

It's pretty helpful as you can store some 5 gigs of files here.

But if you want to let the users upload their own files then this won't help you.

Machta
A: 

PDF is a final format file, ie its is read-only for the most part and can be embedded into the page via the <object> tag, except if you mean downloadable by the user.

Displaying PDF is generally done by rasterising to an image format for display (ie as an image on the page or via a richer interface (with zooming etc) through flash/silverlight etc.

You can use [GhostScript][1] to interpret PDF files and convert them to an image.

[1]: http://www.GhostScript .com

Mark Redman
+2  A: 

The approach I would use in this situation is to upload the PDF as you would any other file, then use a tool like GhostScript to convert the PDF pages into image files that you can show in ASP .Net.

Here's a tutorial doing that in C# http://www.codeproject.com/KB/cs/GhostScriptUseWithCSharp.aspx

Emmanuel
What is purpose of GhostScript cant I just show the PDF file in some PDF viewer? Or .net has noway to do that fro free?
Nick LaMarca
There's no ASP .net or a control that would output HTML out of PDF that I know of. Except may be for flash or silverlight PDF viewers. Ghostscript would be used to convert the PDF into image files that can be displayed on a web page without any other browser plugins such as a PDF Reader or Flash or Silverlight.
Emmanuel
But On That WebPage can I zoom in and out?
Nick LaMarca
Zooming in and out will be difficult if it's just an image. That would require some javascript image zoom library of some sort. If you want to maintain control over the PDF and you want all the functionalities of a viewer I think a flash pdf viewer would be better (requiring less code). You can take a look at SWFTools, there PDF2SWF works and it's free http://wiki.swftools.org/index.php/Examples#pdf2swf
Emmanuel