Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Stream to PDF problem

Reply
Thread Tools

Stream to PDF problem

 
 
=?Utf-8?B?QmFkaXM=?=
Guest
Posts: n/a
 
      12-18-2006
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



 
Reply With Quote
 
 
 
 
Laurent Bugnion
Guest
Posts: n/a
 
      12-18-2006
Hi,

Badis wrote:
> 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
--
Laurent Bugnion, GalaSoft
Software engineering: http://www.galasoft-LB.ch
PhotoAlbum: http://www.galasoft-LB.ch/pictures
Support children in Calcutta: http://www.calcutta-espoir.ch
 
Reply With Quote
 
 
 
 
zee
Guest
Posts: n/a
 
      12-18-2006
Try this out

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

tc

 
Reply With Quote
 
=?Utf-8?B?QmFkaXM=?=
Guest
Posts: n/a
 
      01-08-2007
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

"zee" wrote:

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

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Postscript to PDF with pdf-tools, pdf-writer, or other Sean Nakasone Ruby 1 04-14-2008 09:13 PM
PDF::Writer, create pdf and insert in other pdf file. Ricardo Pog Ruby 1 03-26-2008 08:24 PM
get stream mode flags from an opened stream Alexander Korsunsky C++ 1 02-17-2007 10:38 AM
How to GET multi-word input from a *file* stream as opposed to a *console* stream? sherifffruitfly@gmail.com C++ 9 04-27-2006 04:14 PM
Doing readline in a thread from a popen4('rsync ...') stream blocks when the stream ends. Rasmusson, Lars Python 1 04-30-2004 08:10 AM



Advertisments