Skip navigation
Currently Being Moderated

Adobe 8 - Unexpected Corrupt or incorrect file type warning when viewing a PDF file from the Web

Mar 23, 2007 4:59 AM

Hi,

On downloading a PDF file from my web site using Adobe 8 on the client machine I expect the file to open automatically however I receive encounter the "File Download" dialog. It has the following warning message: "The file you are downloading cannot be opened by the default program. It is either corrupted or it has an incorrect file type. As a security precaution, it is recommended that you cancel the download."

This issue did not occur within previously tested versions of Adobe Reader (e.g. Version 5.1).

On investigating the issue I discovered the factor that results in Adobe 8 failing to open the file automatically is the Content-Type = "application/pdf; Charset=utf-8". However, if I intercept the response and alter the Content-Type to contain only "application/pdf;" the issue on Adobe 8 does not occur.

I have even tested when the Content-Type contains an empty Charset (i.e. "application/pdf; Charset=") but this issue still occurs. In addition setting the Charset to other encodings (e.g. "ISO-LATIN-7", "iso-8859-1") the issue occurs.

QUESTION(s):
1. Why is it necessary for Adobe 8 when opening PDF files from the web to expect no Charset within the Content-Type?
2. If this was not an issue within previous versions of Adobe surly this is a bug?

Since I cannot ensure that the Response's Content-Type does not contain a Charset at all please can someone suggest either a work-around or more importantly a solution to the issue?

Please Note:-
1. Within Adobe, Edit -> Preferences -> Internet option it's compulsory for our users to have "Display PDF in browser" ticked!
2. We cannot prevent a Charset from being present within the Content-Type of the response sent to the client, hence this issue.

Many Thanks in advance,
Martin.
  • Currently Being Moderated
    Community Member
    Mar 23, 2007 1:03 PM
    I'm investigating this for another customer. I'll let you know what I find out.
    |
    Mark as:
  • Currently Being Moderated
    Mar 29, 2007 9:37 AM
    I am also very interested in a resolution/workaround to this issue.

    Our Business Objects XI server spits out PDF files with charset=UTF-8 in the content-type.

    Anyone?
    |
    Mark as:
  • Currently Being Moderated
    Community Member
    Mar 29, 2007 11:01 AM
    Without access to a server that is streaming PDFs with this content type, it's difficult to debug. Can anyone provide access?
    |
    Mark as:
  • Currently Being Moderated
    Apr 4, 2007 1:09 PM
    MarkATS,

    I'm having the same problem with a https site. When the user clicks on the link to the .pdf file, a quick browser window pops up and disapears...we then get the error message. User is still, however, able to save document to desktop and open from there.

    Please let me know when you have a solution...
    |
    Mark as:
  • Currently Being Moderated
    Community Member
    Apr 4, 2007 1:14 PM
    MarkATS,

    BTW: We are using Windows Terminal Server 2003 with SP2.

    Adam
    |
    Mark as:
  • Currently Being Moderated
    Apr 16, 2007 6:29 AM
    i have the same problem. i have a asp.net application. i'm using crystal report and export to a pdf file. this is the script:

    Dim printRep As New CrystalDecisions.CrystalReports.Engine.ReportDocument

    printRep.Load("report.rpt")
    printRep.SetDataSource(myDs)

    Dim oStream As IO.MemoryStream

    oStream = New IO.MemoryStream
    oStream = printRep.ExportToStream(CrystalDecisions.Shared.ExportFormatType.Port ableDocFormat)

    Response.Clear()
    Response.Buffer = True
    Response.ContentType = "application/pdf"
    Response.Charset = ""
    Response.BinaryWrite(oStream.ToArray())
    Response.End()


    in adobe 7 no problem, in adobe 8 i got got a download messagebox to save the file and after i save the pdf file i can open it.

    after i add the next script:
    Response.Charset = ""
    it works OK and open directly the pdf file.
    i would like to know if it's ok to work with no charset.

    thanks

    Dalia
    |
    Mark as:
  • Currently Being Moderated
    Apr 25, 2007 6:15 PM
    We have the same problem, with a workaround.

    In our case, the Charset and Content-Type dont make a difference.

    We've added a dummy parameter on the URL, which seems to fix IE's / AcroRead's behaviour.

    So where we were previously streaming the PDF to the client from the URL like this:

    >http://my.server.name/path1/path2?param1=paramval1&param2=paramval2

    We've added an unused ;/filename.pdf to the URL, like this:

    >http://my.server.name/path1/path2 ;/filename.pdf ?param1=paramval1&param2=paramval2

    In addition to the IE "corrupted or incorrect file type" problem, we've found that it also fixes a problem with firefox ignoring the
    >"Content-Disposition: inline; filename=filename.pdf"
    header.
    |
    Mark as:
  • Currently Being Moderated
    Apr 27, 2007 8:01 AM
    I had the same issue and I use asp.net/vb.net. With me, the PDF would open with Firefox and IE7 using AdobeReader 8. Any older version of AdobeReader or IE would give me the 'corrupt/damaged/incorrect file type' message. Here is the solution I found. The PDF now opens opens in Reader 6, 7, and 8 / IE 6 and 7, / Firefox. Hope it helps you...

    (Note: the pdfPage() function called in line three is where I read the PDF into the MemoryStream)

    Dim m As MemoryStream = New MemoryStream()
    Dim saveFilename As String = "Progress_Report.pdf"
    m = pdfPage()
    Response.ClearHeaders()
    Response.ClearContent()
    Response.ContentType = "application/octet-stream"
    Response.AddHeader("content-disposition", "attachment; filename=" + saveFilename)
    Response.OutputStream.Write(m.GetBuffer, 0, m.GetBuffer.Length)
    Response.OutputStream.Flush()
    Response.OutputStream.Close()
    Response.End()
    |
    Mark as:
  • Currently Being Moderated
    Apr 29, 2007 11:42 AM
    I have the same problem, pdf files will not open in Adobe Reader from any browser. However, I have Mac wtih OS 10.3.9 and am using Reader version 7.9. If I download files to desktop and attempt to open them I get an error message that the file is damaged.
    I have also gone to the Adobe Reader preferences and checked all boxes as recommended allowing files to be donwladed fron browser, etc. Should I just go back to an older version?
    If I need to uninstall 7.9 besides from the following files, folders are there other places I need to go to and putt in trash: preferences, internet plug-ins, applications?

    Nate Griffin
    |
    Mark as:
  • Currently Being Moderated
    Jul 12, 2007 8:56 AM
    I had this same problem, after much research, my problem was found to be with a setting in IE:
    Close all open IE windows-open new IE window-Tools-Internet Options-Advanced-check the box for "Reuse windows for launching shortcuts"-pdf files then opened directly without prompting to save.
    |
    Mark as:
  • Currently Being Moderated
    Aug 28, 2007 10:57 AM
    I have tried all of the workarounds listed here, but have not found one that works for me. I have customers complaining to me of this issue and I must find a solution that they can implement. I have read the related Microsoft article (http://support.microsoft.com/kb/925832) but I can't very well ask my customers to hack their registry.

    I would be happy to offer Adobe support access to my site if it would be helpful in troubleshooting the issue.

    Is there any new information on this issue. My livelihood depends on it!
    |
    Mark as:
  • Currently Being Moderated
    Community Member
    Aug 28, 2007 12:03 PM
    Thank you Martin. I appreciate your quick response.

    Unfortunately, it looks like I'm experiencing a different issue. I have two machines, one with Reader 7 and the other with Reader 8, both fully patched, and both exhibit the same behavior (The file you are downloading cannot be opened by the default program). I'm creating this PDF in ASP.NET with a Crystal Reports object using code very much like that listed above.

    Any other thoughts would be greatly appreciated.
    |
    Mark as:
  • Currently Being Moderated
    Community Member
    Aug 28, 2007 12:14 PM
    Michael,

    Did you try adding the:

    Response.ClearHeaders()
    Response.ClearContent()
    Response.ContentType = "application/octet-stream"
    Response.AddHeader("content-disposition", "attachment; filename=" + saveFilename)

    where saveFileName is the name you want to give the PDF as I mentioned above?

    It took care of the problem that Reader was having with the .Net-created PDF for me...
    |
    Mark as:
  • Currently Being Moderated
    Community Member
    Aug 28, 2007 12:51 PM
    I did try that and it worked! Well...sort of. I didn't get the bad wrning type message, but I was still prompted to eith Open or Save. That's when it occured to me that I have another application that didn't do this last time I tried it, so I tried it again and the document popped right open, just like it should! I've modified my code to the following and have resolved the issues regardless of browser version, Reader version, or OS version.

    Dim thisDataStream As System.IO.MemoryStream = CType(thisReport.ExportToStream(ExportFormatType.PortableDocFormat), IO.MemoryStream)
    With HttpContext.Current.Response
    .ClearContent()
    .ClearHeaders()
    .ContentType = "application/pdf"
    .AddHeader("Content-Disposition", "inline;, filename=report.pdf")
    .BinaryWrite(thisDataStream.ToArray)
    .End()
    End With

    The big difference I see is that I'm not flushing or clearing the output stream. That's what I get for being tidy.

    Thank you all very very much!
    |
    Mark as:
  • Currently Being Moderated
    Sep 12, 2007 2:31 PM
    I am chasing the same "bug".
    http://www.adobeforums.com/cgi-bin/webx/.3bc9d803/0

    The specific program I saw it with today uses, "Gupta Report Builder" (I will return and edit this if spelled wrong) to display a report on screen and then the user send it to their "Adobe PDF" 'printer' to get the PDF file.

    We have been seeing it intermittently for over 6 months!
    |
    Mark as:
  • Currently Being Moderated
    Jan 5, 2008 3:27 PM
    I am getting this same error. I tried with IE 7 and Adobe Reader 8.1.1 and 7.0.9. I also backed off to IE 6 with both versions of Adobe Reader and get the same error. It doesn't happen on all web sites, but on about 1/2 that I've tried to access. Was any solution ever created for this problem?
    |
    Mark as:
  • Currently Being Moderated
    Community Member
    Jan 5, 2008 3:29 PM
    I am getting this same error message when trying to open PDF files on some sites (not all). I tried with IE 7 and Adobe Reader 8.1.1. I tried with IE 7 and Adober Reader 7.0.9. I tried with IE 6 and Adobe Reader 8.1.1. I tried with IE 6 and Adobe Reader 7.0.9.

    Was any resolution to this issue ever published?

    Thanks!
    |
    Mark as:
  • Currently Being Moderated
    Community Member
    Jan 7, 2008 6:57 AM
    Just a thought:
    Could this issue be the result of Adobe .PDF documents having some charset specification WITHIN the document rather than in the HEADER? I'm not a programmer, so this is just a stab in the dark, if what I am suggesting is technically impossible/irrelevant, please excuse the bits wasted on it.

    Oh, and HAPPY NEW YEAR!!
    |
    Mark as:
  • Currently Being Moderated
    Community Member
    Jan 7, 2008 7:03 AM
    Some comment (I don't know what is going on with the problem): PDF
    files are always self-defined in terms of character set. HTTP headers
    have no affect on how a PDF is to be interpreted.

    It is also worth considering that the decision on whether or how a PDF
    is opened, and whether error messages are produced, belongs to the
    browser. Adobe Reader has no involvement (other than, perhaps,
    passively in the registry entries it has defined) in the error message
    reported. UNLESS in this case Adobe Reader *is* the browser (i.e. if
    a link in a PDF is being followed). How is the link to the PDF
    followed, and what is the browser?

    This may also be relevant: http://support.microsoft.com/kb/925832

    Aandi Inston
    |
    Mark as:
  • Currently Being Moderated
    Community Member
    Jan 7, 2008 7:26 PM
    Thanks for the responses.

    Dennis: If I download the file to the desktop it opens just fine so I'm thinking it isn't a problem with the contents of the pdf file itself.

    Aandi: It is a link on a web site. I click on the link and instead of opening the pdf file it gives me this error. I get the error with IE6 and IE7. Note that it isn't every pdf file. I just get it on about 1/2 of the sites I try to access pdf files from.

    I looked at the microsoft kb article. It says it only applies if the following are true:

    Consider the following scenario:
    You are using Microsoft Internet Explorer 6 or Windows Internet Explorer 7.
    In Internet Explorer, you browse a file that uses a custom MIME type.
    The MIME handler for the custom MIME type is registered.

    I'm not sure if the 2nd and 3rd item are true. Is pdf a custom MIME type? How do I tell if it is registerd?

    Thanks!

    Bill
    |
    Mark as:
  • Currently Being Moderated
    Community Member
    Jan 8, 2008 7:13 AM
    Here is a Microsoft Knowledge Base document about creating a File Type association for a "custom" type of file (e.g. *.doc, *.pdf, etc), but I do not think this is exactly what the issue involves.

    "OL2000: Can't Open Word Attachments with Custom Extensions"
    http://support.microsoft.com/kb/197090/en-us

    MS KB Keywords searched to turn up these (20) documents:
    [register custom MIME type ]

    A second Knowledge Base article addresses the location where some MIME type settings are kept in Windows' Registry file, and that article is:

    "PPT97: Where Settings are Stored in the Registry"
    http://support.microsoft.com/kb/228995/en-us

    Of course, making custom edits or additions to the Registry file is something ANY user undertakes at their OWN RISK!!

    These articles are not specifically related to the issue under discussion, but it is my hope they may provide participants with the additional tools and information necessary to further isolate the exact nature of the issue. I further advise ALWAYS making detailed notes on the settings found (as they originally exist) before making any changes or additions.
    |
    Mark as:
  • Currently Being Moderated
    Community Member
    Jan 8, 2008 7:00 PM
    Dennis,

    Thanks for the info, but I already have pdf files associated with Adobe Reader. The program opens right up and reads the file if I download it to my desktop and click on it. It doesn't work if I click on the link on the web page. That's when I get the error.

    Thanks!

    Bill
    |
    Mark as:
  • Currently Being Moderated
    Community Member
    Jan 8, 2008 7:22 PM
    Bill,

    This is exactly the same behavior I observed when I rendered a PDF stored in a database through a .NET page. If I chose to save it, it would open fine after the save, but if I chose to open it in the browser without saving it, I would get the error.

    The problem was not with the PDF or Acrobat. It was with the way I was delivering the PDF. Putting the following code before my binarywrite fixed the issue completely:

    Response.ClearHeaders()
    Response.ClearContent()
    Response.ContentType = "application/octet-stream"
    Response.AddHeader("content-disposition", "attachment; filename=" + saveFilename)

    where saveFileName is the name you want to give the PDF.

    You can use 'inline' instead of 'attachment' above if you just want the PDF to open (no option to save first). You can also use 'pdf' instead of 'octet-stream' (not sure the difference).

    The trouble seems to be that .NET puts some info in the header and/or content by default prior to anything your code says to write. If you don't clear this, IE has an issue with it. Other browsers seem to ignore it.

    Bottomline is that this is an issue the website programmer needs to fix and is not something the user can fix by changing some setting(s).

    I hope this helps.
    |
    Mark as:
  • Currently Being Moderated
    Community Member
    Jan 8, 2008 7:38 PM
    Hi Mike,

    Thanks for the reply. I guess what is weird is that I'm having this problem, but my wife is able to access the pdf file fine on her computer using the same browser and Adobe Reader version. Also the same Windows XP version. I've compared all of my settings in IE and in Adobe Reader and can't see anything obviously different.

    Bill
    |
    Mark as:
  • Currently Being Moderated
    Community Member
    Jan 8, 2008 7:53 PM
    I wish I could tell you why, or that someone could tell me why, but I had the same experience. I developed my website on my PC and the pdf's opened fine. I had a fellow developer test my site and he opened the pdf's fine. I then asked several other people in my department to test my app and that's when the trouble showed. Some people got the error, some didn't. We all have identical PC's and similar software installed. We were never able to figure out why some got the error and others didn't. Matter of fact, that's why I stay subscribed to this thread, hoping someone can tell me why. But, without knowing why it randomly occurred, I was able to stop it from occurring at all by clearing the headers and content in my code. I know that doesn't help ffrom a user standpoint...
    |
    Mark as:
  • Currently Being Moderated
    Community Member
    Jan 8, 2008 8:11 PM
    Mike,

    Thanks again for the info. I too will stay subscribed to this message in case somebody comes up with something.

    Thanks!

    Bill
    |
    Mark as:
  • Currently Being Moderated
    Feb 7, 2008 4:16 AM
    Hi,

    just tried the following :

    I added :
    Response.Clear
    Response.ContentType = "application/octet-stream"
    Response.AddHeader "content-disposition", "attachment;filename=report.pdf"

    before the actuale PDF generation.

    Now it opens correctly with IE7 without the security warning (Save,Cancel).

    If I leave the filename empty or incorrect (eg filename=.pdf) the error returns..

    Greets
    Arnout
    |
    Mark as:
  • Currently Being Moderated
    Community Member
    Feb 7, 2008 7:29 AM
    Hi Arnout,

    Thanks for replying. My problem is that I am getting the error when I visit pages on the web and try to open PDF files to read them. I have no control over the web pages themselves. I was hoping there was something I could do to fix this. As of today the only option I have is to use a different browser, Firefox or Safari both work fine.

    Thanks!

    Bill
    |
    Mark as:
  • Currently Being Moderated
    Apr 22, 2008 1:41 PM
    Hi All

    We have an app that dynamically generates PDF using FOP deployed on JBoss server running on AIX. My machine has IE 6 and Adobe Reader 8.1.2 with browser plug-in installed on Windows XP SP2.

    PDF the app generates, doesn't open up within IE using the plug-in. But as I could save the PDF file and then open it using Adobe Reader, I went ahead and unchecked the option "Display PDF in Browser" (under Adobe Reader's Edit->Preferences->Internet). Doing so, opens up the PDF automatically using Adobe Reader instance outside of the browser. Though it works, I would like to avoid having all our users change their settings.

    Another strange thing that I noticed is that when I run the app on my local machine with a windows version of JBoss, PDF opens up automatically w/o any issues in IE with Adobe plugin. But if the same code is deployed to the JBoss server on AIX it won't open in IE.

    For testing purpose, I tried installing Foxit PDF reader, making it the default and PDF opens up fine under both Windows and AIX instances of JBoss.

    Any help is greatly appreciated.

    Thanks
    Anup Alex
    |
    Mark as:
  • Currently Being Moderated
    Apr 24, 2008 3:27 PM
    Well, I guess you better stay with Foxit Reader then.
    |
    Mark as:
  • Currently Being Moderated
    Apr 27, 2008 1:39 PM
    I keep getting an error msg everytime I try to download Adobe Reader 8, can you please help me.

    Error 1406. Could not write value to key/softwart/classes/AcroIEHelper.AcroIEHlprObj.1. Verify that you have sufficient access to that key, or contactyour support personnel.

    Then I tried again and got another error msg.

    Error 1406. Could not write value to key/software/classes/TypeLib/{5F226421-415D-408D-9A09-0CD94E25B48}. Verify that you have sufficient access to that key, or contact your support personnel.

    My email address is: waltonet@comcast.net
    |
    Mark as:
  • Currently Being Moderated
    Jun 6, 2008 4:41 AM
    I have the same problem guys

    In my local server the code works fine.
    when i ypload the pages and the report to the web server the pdf , in both cases (open or download) throws an error message.

    I noticed that the pdf file, when i download it has 0 kb size !!!

    Can it be, that the webserver can't create it ? how can i check it?

    by the way, at the web server, in other pages, the same code, works fine!!!!

    it drives me crazy
    |
    Mark as:
  • Currently Being Moderated
    Aug 26, 2008 10:50 PM
    HI All ,

    I am having the problem with ie7 while open a pdf file form application n,the extension of the file is .DO instead of not pdf,it takes .do from the URL.I am using struts.

    here is my code .

    servletResponse.setContentType("application/pdf");
    servletResponse.setCharacterEncoding("UTF-8");
    servletResponse.setContentLength(out.size());
    ((HttpServletResponse) servletResponse).setHeader(CONTENT_DISPOSITION, "attachment;filename=Print_Document.pdf");

    please help me .

    Thanks.
    Parames.
    |
    Mark as:
  • Currently Being Moderated
    Nov 10, 2008 6:54 PM
    We experienced this issue on our XPSP2/IE7/Reader 8.1+ computers.
    I found this MS workaround that resolved the issue for our situation:

    http://support.microsoft.com/kb/925832/en-us

    Set the iexplore.exe DWORD value to 0 in the following registry subkeys, and then open the online version of the file:

    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_MIME_HANDLING

    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_MIME_SNIFFING
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)