|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
programmically open a pdf file in vb.netHi
I have a webpage with a link to a pdf file on it. Right now the user has to click on the pdf file link to open and display the file. Does anyone know how I can get the web page to just open the pdf file automatically without using a link and the user having to click on it? Thanks, CindyH The usual approach is to stream the PDF as the response from your page
request, as opposed to sending a link for the user to click on - or to simply do a response.redirect to th PDF URL as your only output to your initial page request (containing your current clickable link) http://support.microsoft.com/default.aspx?scid=kb;en-us;Q306654 There are some gotchas that people sometimes fall foul of, and a solution to some of them explained here: http://groups.google.co.uk/group/microsoft.public.dotnet.framework.aspnet/browse_thread/thread/6e37cf96f8c9a50e/29fdd72345009fff?lnk=st&q=asp.net+PDF+timney&rnum=7&hl=en#29fdd72345009fff -- Show quoteHide quoteRegards John Timney (MVP) "Cindy H" <nonn***@nowhere.com> wrote in message news:uwQaccfnGHA.1604@TK2MSFTNGP03.phx.gbl... > Hi > > I have a webpage with a link to a pdf file on it. > Right now the user has to click on the pdf file link to open and display > the > file. > Does anyone know how I can get the web page to just open the pdf file > automatically without using a link and the user having to click on it? > > Thanks, > CindyH > > Hey - that works great - thank you!
"John Timney (MVP)" <x_j***@timney.eclipse.co.uk> wrote in message http://groups.google.co.uk/group/microsoft.public.dotnet.framework.aspnet/browse_thread/thread/6e37cf96f8c9a50e/29fdd72345009fff?lnk=st&q=asp.net+PDF+timney&rnum=7&hl=en#29fdd72345009fffnews:SrydneI1iqL8pDXZRVnyvQ@eclipse.net.uk... > The usual approach is to stream the PDF as the response from your page > request, as opposed to sending a link for the user to click on - or to > simply do a response.redirect to th PDF URL as your only output to your > initial page request (containing your current clickable link) > http://support.microsoft.com/default.aspx?scid=kb;en-us;Q306654 > > There are some gotchas that people sometimes fall foul of, and a solution to > some of them explained here: > Show quoteHide quote > > -- > Regards > > John Timney (MVP) > > > "Cindy H" <nonn***@nowhere.com> wrote in message > news:uwQaccfnGHA.1604@TK2MSFTNGP03.phx.gbl... > > Hi > > > > I have a webpage with a link to a pdf file on it. > > Right now the user has to click on the pdf file link to open and display > > the > > file. > > Does anyone know how I can get the web page to just open the pdf file > > automatically without using a link and the user having to click on it? > > > > Thanks, > > CindyH > > > > > > Hi
I used the code below, which works great on local machine, but when I uploaded it to hosting site and then tried it, I get a window popping up that ask if I want to download or open the file. Do you know how to get around this? Thanks, CindyH 'Set the appropriate ContentType. Response.ContentType = "Application/pdf" 'Get the physical path to the file. Dim FilePath As String = MapPath("Reports\CurrentYear_ShootDates.pdf") 'Write the file directly to the HTTP content output stream. Try Response.WriteFile(FilePath) Catch ex As Exception Response.Redirect("DownloadPDFReader.aspx") Response.End() End Try Response.End() "John Timney (MVP)" <x_j***@timney.eclipse.co.uk> wrote in message http://groups.google.co.uk/group/microsoft.public.dotnet.framework.aspnet/browse_thread/thread/6e37cf96f8c9a50e/29fdd72345009fff?lnk=st&q=asp.net+PDF+timney&rnum=7&hl=en#29fdd72345009fffnews:SrydneI1iqL8pDXZRVnyvQ@eclipse.net.uk... > The usual approach is to stream the PDF as the response from your page > request, as opposed to sending a link for the user to click on - or to > simply do a response.redirect to th PDF URL as your only output to your > initial page request (containing your current clickable link) > http://support.microsoft.com/default.aspx?scid=kb;en-us;Q306654 > > There are some gotchas that people sometimes fall foul of, and a solution to > some of them explained here: > Show quoteHide quote > > -- > Regards > > John Timney (MVP) > > > "Cindy H" <nonn***@nowhere.com> wrote in message > news:uwQaccfnGHA.1604@TK2MSFTNGP03.phx.gbl... > > Hi > > > > I have a webpage with a link to a pdf file on it. > > Right now the user has to click on the pdf file link to open and display > > the > > file. > > Does anyone know how I can get the web page to just open the pdf file > > automatically without using a link and the user having to click on it? > > > > Thanks, > > CindyH > > > > > >
WebBrowser1.DocumentText
Multithreaded Updating of StatusBar HTML edit Vb.net how to delete a file when the windows start Sudoku array-problem problem with string function in vb.net XML or SQL Server? Font size not right when converting from RTF to Web DLL in VB.NET Publishing An ASP.NET Website With Visual Studio .NET 2005 |
|||||||||||||||||||||||