Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > PDF File Corrupt

Reply
Thread Tools

PDF File Corrupt

 
 
=?Utf-8?B?QmFkaXM=?=
Guest
Posts: n/a
 
      01-15-2007
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.

 
Reply With Quote
 
 
 
 
Mark Fitzpatrick
Guest
Posts: n/a
 
      01-15-2007
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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.
>



 
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
PDF::Writer, create pdf and insert in other pdf file. Ricardo Pog Ruby 1 03-26-2008 08:24 PM
ADODB.Stream 'format error: not a pdf or corrupt' only on large file iporter ASP General 6 03-30-2007 03:28 PM
Corrupt PDF files When File is written to the response. eventuranza@gmail.com ASP .Net 7 08-30-2006 10:32 AM



Advertisments