Opening a .pdf file at the clientside without the open/save dialog box

Please support our ASP.NET advertiser: $4.95 a Month - ASP.NET Web Hosting – Click Here!
Reply

Join Date: Jul 2006
Posts: 10
Reputation: Phoenix777 is an unknown quantity at this point 
Solved Threads: 0
Phoenix777 Phoenix777 is offline Offline
Newbie Poster

Opening a .pdf file at the clientside without the open/save dialog box

 
0
  #1
Dec 10th, 2006
Hi guys

Need some help with an problem thats bugging me..
I have to open a .pdf file at the client side when the user clicks a button..

Opening is not a problem.. I am able to do it using the following code
which is executed when the user clicks on the button

MyFileStream = New FileStream("E:\MyWork\Test\DownloadFiles\Reports\Rpt.pdf", FileMode.Open)
FileSize = MyFileStream.Length
Dim Buffer(CType(FileSize, Integer)) As Byte
MyFileStream.Read(Buffer, 0, CType(MyFileStream.Length, Integer))
MyFileStream.Close()
Response.ContentType = "application/pdf"
Response.AddHeader("content-disposition", "attachment; filename=MyReport.PDF")
Response.BinaryWrite(Buffer)


The problem is that the user first sees a 'Open/ Save / Cancel' dialog box. Only when the user clicks on 'Open' does the .pdf file get opened.
My client wants it to be opened directly when the button is clicked.
Am at a loss and any help will be appreciated...

Thanks in advance
Reply With Quote Quick reply to this message  
Join Date: Jul 2006
Posts: 10
Reputation: Phoenix777 is an unknown quantity at this point 
Solved Threads: 0
Phoenix777 Phoenix777 is offline Offline
Newbie Poster

Re: Opening a .pdf file at the clientside without the open/save dialog box

 
0
  #2
Dec 12th, 2006
Also is there any other way to open the file at the client side?
Reply With Quote Quick reply to this message  
Join Date: Dec 2006
Posts: 6
Reputation: sushanth is an unknown quantity at this point 
Solved Threads: 1
sushanth's Avatar
sushanth sushanth is offline Offline
Newbie Poster

Re: Opening a .pdf file at the clientside without the open/save dialog box

 
0
  #3
Dec 13th, 2006
Hi ,
R u seaching for something like this.....

String strPop = "<script language='javascript'>" + Environment.NewLine +
"window.open('E:\MyWork\Test\DownloadFiles\Reports\Rpt.pdf"','Report','height=520,width=730,toolbars=no,scrollbars=yes,resizable=yes');" + Environment.NewLine +
"</script>" + Environment.NewLine;
Page.RegisterStartupScript("Pop", strPop);
Hope this will help u

With Warm Regards,
Sushanth.CP
Sr. Software Engineer
Reply With Quote Quick reply to this message  
Join Date: Oct 2006
Posts: 257
Reputation: Dukane is an unknown quantity at this point 
Solved Threads: 22
Dukane's Avatar
Dukane Dukane is offline Offline
Posting Whiz in Training

Re: Opening a .pdf file at the clientside without the open/save dialog box

 
0
  #4
Dec 14th, 2006
I think that all depends on the client's browser.
Reply With Quote Quick reply to this message  
Join Date: Mar 2006
Posts: 84
Reputation: web_developer is an unknown quantity at this point 
Solved Threads: 1
web_developer web_developer is offline Offline
Junior Poster in Training

Re: Opening a .pdf file at the clientside without the open/save dialog box

 
0
  #5
Dec 16th, 2006
dude

i think the best thing is using javascript to open the pdf

try this:

<INPUT id="btnopen" type="button" value="open report" name="Button1" onclick="location.href='linux1-sample.pdf'">

sam
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC