Getting error when trying to display PDF file in classic ASP

5 pts.
Tags:
ASP
PDF
I have an .ASP page that has been working fine for months displaying PDF files. I just brought in a collection of 8,000 new PDF documents and now I get a "The file is damage and could not be repaired." when trying to view these new PDF documents in Internet Explorer. The PDFs view fine in Google Chrome. This is a public-facing website so I don't have control over what browser the user is using. Here is the code:
Set oFileStream = Server.CreateObject("ADODB.Stream")
oFileStream.Open
oFileStream.Type = 1 'Binary
oFileStream.LoadFromFile "c:ldpdfsAHCD.pdf"

Response.ContentType = "application/pdf"
Response.AddHeader "Content-Disposition", "inline; filename=" +

PDFpath
Response.BinaryWrite(oFileStream.Read)

oFileStream.Close
Set oFileStream= Nothing
Please help. Thanks,

Answer Wiki

Thanks. We'll let you know when a new response is added.

No approved answer yet.

See discussion below.

Discuss This Question: 2  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.
  • ToddN2000
    What version of IE are you using? Can these PDF be opened using Acrobat Reader?
    111,200 pointsBadges:
    report
  • carlosdl
    If the PDF files are not being generated by your company, then there is probably not much you can do, since it has most likely something to do with the PDF format and the browser being used (which you can't control).

    If you change the Content-Disposition header to "attachment" (instead of "inline") the file will be offered as a download (or be opened with an installed PDF viewer) instead of trying to be displayed by the browser.  Is that an option?
    84,535 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.

Following

Share this item with your network: