Stream to PDF problem

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

I have a PDF document saved as Binary Stream in my Database and I'm excuting
this line of code to open the PDF document:
Response.BinaryWrite(myfile); // myfile is the stream converted to byte[] type

and It's working fine, but the only problem that Acrobat Reader 8 is not
opening it directly but always asking me if I want to save it or Cancel. So,
I always have to save disk before opening it!!!? so what could be the issue
with Acrobat Reader 8.


Thanks
 
Hi,
Hi,

I have a PDF document saved as Binary Stream in my Database and I'm excuting
this line of code to open the PDF document:
Response.BinaryWrite(myfile); // myfile is the stream converted to byte[] type

and It's working fine, but the only problem that Acrobat Reader 8 is not
opening it directly but always asking me if I want to save it or Cancel. So,
I always have to save disk before opening it!!!? so what could be the issue
with Acrobat Reader 8.

The one asking you if you want to save or open is not Acrobat, it's the
web browser. The question is triggered by the user's configuration for
the give MIME type returned by the web server. In your case, the MIME
type is (or should be) "application/pdf". When the browser receives
this, it will check how it has been configured for this MIME type. If
not setting is found, or depending on what the user entered, he will
present the open/save dialog to the user.

So bottom line is: You cannot force the user to open the document
automatically if he doesn't want. You cannot control how each web
browser is going to react.

HTH,
Laurent
 
Try this out

Response.AddHeader("Content-Disposition", "inline;filename=File.pdf");
Response.ContentType = "application/pdf";
Response.BinaryWrite(myfile);
Response.Flush();
Response.Close();

tc
 
Hi ,

thanks Zee you code has solve the problem but the only thing is that that
pdf document is now opening in main page and I would like it to be opened in
a new page

Cheers
 
Back
Top