PDF File Corrupt

Discussion in 'ASP .Net' started by =?Utf-8?B?QmFkaXM=?=, Jan 15, 2007.

  1. Hi,

    I'm running this code to open a stream as pdf file:
    Response.ContentType = "application/pdf";
    try
    { mystream = someStream....;
    byte[] myfile = mystream.ReadBytes((int)someStreamLenght);
    myfile.Length.ToString();
    Response.BinaryWrite(myfile);
    }
    finally
    {
    Response.Flush();
    Response.Close();
    mystream.Close();
    }
    but I run it in a 3 different machines it's telling me that the file is
    corrupt or damaged.
    and when running it in different machine that have the latest Acrobat 8.0
    the document is opening fine!!!?
    is this an issue with ASP? because I running VS 2005.

    Cheers.
     
    =?Utf-8?B?QmFkaXM=?=, Jan 15, 2007
    #1
    1. Advertisements

  2. If this code is behind an .aspx page, make sure there isn't anything in the
    actual .aspx design surface. You can have the page directive and such, but
    you can't have the html elements or anything else. I find making sure that
    you don't have any spaces there either it helps, just the page directive and
    any references or other directives and nothing else.


    --

    Hope this helps,
    Mark Fitzpatrick
    Former Microsoft FrontPage MVP 199?-2006


    "Badis" <> wrote in message
    news:...
    > Hi,
    >
    > I'm running this code to open a stream as pdf file:
    > Response.ContentType = "application/pdf";
    > try
    > { mystream = someStream....;
    > byte[] myfile = mystream.ReadBytes((int)someStreamLenght);
    > myfile.Length.ToString();
    > Response.BinaryWrite(myfile);
    > }
    > finally
    > {
    > Response.Flush();
    > Response.Close();
    > mystream.Close();
    > }
    > but I run it in a 3 different machines it's telling me that the file is
    > corrupt or damaged.
    > and when running it in different machine that have the latest Acrobat 8.0
    > the document is opening fine!!!?
    > is this an issue with ASP? because I running VS 2005.
    >
    > Cheers.
    >
     
    Mark Fitzpatrick, Jan 15, 2007
    #2
    1. Advertisements

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. Jacky Kwok

    Re: Mail object and Corrupt PDF Files

    Jacky Kwok, Aug 27, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    2,084
    DataNumen
    Nov 18, 2006
  2. darrel
    Replies:
    3
    Views:
    699
    Darrel
    Apr 6, 2006
  3. Replies:
    7
    Views:
    840
  4. iporter
    Replies:
    6
    Views:
    834
    Anthony Jones
    Mar 30, 2007
  5. B
    Replies:
    9
    Views:
    524
  6. Flaming Flamingo

    check corrupt PDF file

    Flaming Flamingo, Jan 24, 2008, in forum: Ruby
    Replies:
    1
    Views:
    570
    Flaming Flamingo
    Jan 24, 2008
  7. Ricardo Pog
    Replies:
    1
    Views:
    801
    Austin Ziegler
    Mar 26, 2008
  8. Sean Nakasone
    Replies:
    1
    Views:
    676
    Farrel Lifson
    Apr 14, 2008
Loading...