Stream to PDF problem

Discussion in 'ASP .Net' started by =?Utf-8?B?QmFkaXM=?=, Dec 18, 2006.

  1. 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
    =?Utf-8?B?QmFkaXM=?=, Dec 18, 2006
    #1
    1. Advertising

  2. 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
    Laurent Bugnion, Dec 18, 2006
    #2
    1. Advertising

  3. =?Utf-8?B?QmFkaXM=?=

    zee Guest

    Try this out

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

    tc
    zee, Dec 18, 2006
    #3
  4. 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
    >
    >
    =?Utf-8?B?QmFkaXM=?=, Jan 8, 2007
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?VGltOjouLg==?=

    PDF File stream problem... HELP...

    =?Utf-8?B?VGltOjouLg==?=, Sep 8, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    5,286
    =?Utf-8?B?VGltOjouLg==?=
    Sep 8, 2005
  2. Rasmusson, Lars
    Replies:
    1
    Views:
    714
    popov
    Apr 30, 2004
  3. Replies:
    5
    Views:
    1,012
  4. Ricardo Pog
    Replies:
    1
    Views:
    398
    Austin Ziegler
    Mar 26, 2008
  5. Sean Nakasone
    Replies:
    1
    Views:
    339
    Farrel Lifson
    Apr 14, 2008
Loading...

Share This Page