tags:

views:

1207

answers:

6

User click on a link button and it will direct them to a url that is dynmaically generated which a pdf file. The browser will prompt the user to either save or open it.

I want to know if it is possible to downlaod the pdf file to the server then show the pdf file in the asp.net web page. When i google on this question, 99% of top link are some third party component. Is it a way to do this without purchase any 3rd party component?

thank

A: 

I don't think that you'll have much luck without a 3rd party component. First, the issue isn't showing the PDF, it is generating it. For that, you'll need a library to help. Rolling one yourself would not be cheaper unless you have an enormous amount of unpaid time on your hands.

With respect to third-party controls, I recommend and use DynamicPDF from CeTe.

Mark Brittingham
@mdbritt - actually generating a PDf file is inherent in RDLC so it's nearly native to the ASP.NET environment.
Stephen Wrighton
A: 

Yes there is a way to do this without a 3rd party tool, but it involves coding a PDF-to-html translator.

If this is something for a business, the RoI for the 3rd party control is that you don't have to spend hundreds of hours coding & testing this component, when you could buy one for just a few hundred dollars.

Now, an alternative is to code a page which displays the data in the same way which the PDF file generates it (this could actually be handled by RDLC). So that when the user clicks the link button, they are taken to this display page, from which they can download the PDF version if they want a local copy.

Stephen Wrighton
+3  A: 

I use itextsharp, its a free open source c# port of the java itext library.

Makes generating dynamic pdfs in asp.net a breeze and there is lots of documentation/examples floating around.

Element
A: 

Regardless of how you generate the PDF, I have found a better user experience if you open the PDF in an IFRAME instead of the full browser window. You can give users instructions and maintain the browser navigation.

toddb
A: 

I think what you want to do is by going to: http://my_site.com/generate-pdf.aspx?=someId this should in fact just show the PDF file? What you need to do is change the Response type.

See here for how to do this with images.

Filip Ekberg
A: 

Look up the Content-Disposition HTTP header. You can send back a value that requests the content be displayed inline instead of downloaded.

stevex