Solved

How to display pdf documents that do not have .pdf extension in internet explorer

Posted on 2008-06-20
13
430 Views
Last Modified: 2013-12-08
I have created a document viewer in ColdFusion to retrieve documents out of our imaging database.  Hyperlinks to the documents are dynamically created and reference an asp.net webservice.  The url to the retrieve the documents looks like the following: http://servername/pathtowebservice/getImg.aspx?documentID=51086fd9-8518-4cc2-a9fd-528b8f9fe4f8, where documentID is a unique identifier to the document without a file extension.  Most documents are .tiff, which we have set to open with Microsoft Office Document Imaging with no issues.  However, internet explorere displays "Internet explorer cannot display this webpage" when trying to access documents of type PDF.  I tried disabling the "display in browser" feature of Adober Reader, and the links will open up in Reader. I am able to right-click the link and "save as", and the file is retrieved and downloaded and as a PDF.  Due to other programs in use, I need the ability to open PDF's in internet explorer and this was not a viable solution.  I have tried configuring PDF MIME types in IIS on both the calling and receiving servers with no success.  I have repaired the Adobe installation and cheked for the existence of the necessary .dll files and add-ons in internet explorer. LInks to other PDF documents on different websites open in Internet Explorer without issue.   Any questions or comments on how I can get the PDF's to display will be greatly appreciated.  
0
Comment
Question by:lbhc
13 Comments
 
LVL 5

Expert Comment

by:virtuatech
ID: 21833807
Does opening a PDF in IE work at any random site?  Try this:
http://vmware.com/files/pdf/ThinAppFAQ.pdf
0
 
LVL 11

Expert Comment

by:asafadis
ID: 21833828
Look into setting the MIME type in the actual page, not the IIS server.
I'm no ASP expert, so I really can't provide any examples... but the concept remains.
0
 
LVL 1

Author Comment

by:lbhc
ID: 21833873
virtuatech,
as mentioned in my question I have no problem accessing PDF's from other websites or other applications I have written.  The problem seems to solely rest on retrieving the PDF's from the webservice, or more precisely a link to a pdf that does not contain the .pdf extension.
0
What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

 
LVL 1

Author Comment

by:lbhc
ID: 21833903
asafadis:
thank you for your reply, but the document does indeed have it's MIME type set before it is saved in the database.  WIthout that eventuality, I do not believe that I could right-click the link and have it saved automatically as a PDF, which is the behavior that is currently produced.  
0
 
LVL 5

Expert Comment

by:virtuatech
ID: 21834086
It has to be something in the programming of your webservice.  There is no problem with IE if you are able to do it on other sites.  Do the TIF files behave the same way, I mean like when you do a save as, they do not have the .TIF extension?
0
 
LVL 1

Author Comment

by:lbhc
ID: 21834167
virtuatech:
Each call to the webservice is made with the documentID, which does not include an extension.  This goes for .TIF files as well as HTML and JPG files.  In every case, the file will open with the appropriate application. TIF with Document Imaging, HTML and JPG within Internet Explorer.  It is only the PDF files that will not open.  If I right click the PDF link and do a Save As, I get a dialog box that says "getting file information" from getImg.aspx (the webservice function), a few seconds later a save dialog box will open with getImg.pdf (including the extension) filled in for the file name and saves appropriately as a pdf.  The pdf seems to be recognized as such with this explicit download instruction, just not by clicking the link directly.  
0
 
LVL 5

Expert Comment

by:virtuatech
ID: 21834213
What is the URL shown in the address bar when the PDF link is left-clicked, after the "Internet Explorer cannot display this webpage"?
0
 
LVL 1

Author Comment

by:lbhc
ID: 21834285
0
 
LVL 5

Expert Comment

by:virtuatech
ID: 21834556
Have you tried it with Firefox? or IE7?  Or maybe updating Acrobat viewer...
0
 
LVL 1

Author Comment

by:lbhc
ID: 21834870
virtuatech:
I am currently using IE7 and have the latest version, and no other version of Reader installed.  Using Firefox yields interesting results.  Clicking on the link in Firefox yields a Open With / Save to disk dialog where I can choose to open the link with Acrobat Reader (executable AcroRd32.exe), which opens the file properly.  It is due to this behavior, and the fact that I can disable PDF's from opening in internet explorer through the preferences in Adobe Reader and the link opens just fine in Reader, that I believe the problem rests in the the Acrobat plugins for IE, or how IE is configured to access pdf's and / or files without extensions.  Using firefox however is not an option for my company and therefor is unfortunately not a solution to this particular problem.  
0
 
LVL 5

Expert Comment

by:virtuatech
ID: 21834893
Is your Reader version up-to-date?  Try reinstalling it.
0
 
LVL 5

Expert Comment

by:virtuatech
ID: 21834900
Check the settings in Internet Options -> Programs -> Manage Addons...
0
 
LVL 7

Accepted Solution

by:
Dauhee earned 500 total points
ID: 21837607
with asp.net could you write it out to the browser with something like:

                Response.Clear()
                Response.ContentType = "Application/pdf"
                Response.AddHeader("Content-Disposition", "inline; filename=" & IO.Path.GetFileName(strFileName).Replace(" ", "_"))
                Response.WriteFile(strFileName)
                Response.Flush()
                Response.End()


this way the browser is told what application to use and won't be concerned with the file extention
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Do you come here a lot? Are you lazy like me and don't want to go through the "trouble" of having to click your Dock's Safari icon and then having to click your Experts Exchange Favorites bookmark to get here? Well then this article is for you.
Citrix XenApp, Internet Explorer 11 set to Enterprise Mode and using central hosted sites.xml file.
Use Wufoo, an online form creation tool, to make powerful forms. Learn how to choose which pages of your form are visible to your users based on their inputs. The page rules feature provides you with an opportunity to create if:then statements for y…
Learn how to set-up custom confirmation messages to users who complete your Wufoo form. Include inputs from fields in your form, webpage redirects, and more with Wufoo’s confirmation options.

792 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question