Stream to PDF problem

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
 
L

Laurent Bugnion

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
 
Z

zee

Try this out

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

tc
 
G

Guest

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,825
Latest member
VernonQuy6

Latest Threads

Top