Solved

PDF irrecognizable code

Posted on 2011-03-16
18
465 Views
Last Modified: 2012-05-11
I am creating a website with links to the pdf file. The webpages and pdf files are stored in one server. The pdf file can be opened through IE browser but not through the firefox browser.      try to open pdf file the page source
0
Comment
Question by:hanjgr
  • 9
  • 7
18 Comments
 

Author Comment

by:hanjgr
Comment Utility
I have tried several things according to the post #16012445 and other results I googled on line:
1. Installed Foxit Reader
2. Installed Adobe Reader X also Naunce PDF reader and all are up-to-date
3. Ran windows updates and firefox is up-to-date too.

I can open pdf file in Firefox through "File/Open File...." on that server. but when it comes to website address like :http://rims.gvmc-regis.org/supportcenter/help/quickref/01_How_to_Login9X2.pdf ( still on the same server) it gives me "corrupted" things like shown in the pictures.

I really appreciate any help!

0
 
LVL 44

Assisted Solution

by:Karl Heinz Kremer
Karl Heinz Kremer earned 500 total points
Comment Utility
Make sure that your web server sends the correct MIME code for PDF files (application/pdf). This looks like Firefox does not know what to do with these PDF files.
Can you display PDF files from other web sites correctly in Firefox?
 
0
 

Author Comment

by:hanjgr
Comment Utility
I can display pdf file from other web sites through firefox.
0
 

Author Comment

by:hanjgr
Comment Utility
How to make sure the the correct MIME code for PDF files are sent correctly?
what do you mean by "application/pdf"?
0
 
LVL 44

Assisted Solution

by:Karl Heinz Kremer
Karl Heinz Kremer earned 500 total points
Comment Utility
On the web server, you need to make sure that the server sends the correct mime type (and that is "application/pdf") for PDF files. If you do not control the server, you need to talk to your hosting provider and have them make that change.
Do you know what server you are using?
Are you using server side scripting to send the PDF files? In that case, it's your responsibility to send the correct HTTP header information (e.g. the MIME type).
0
 

Author Comment

by:hanjgr
Comment Utility
The web server is windows server 2003 32 bit, with MS IIS to manage the website.
I have check the the MIME Type setting from IIS manager-> local Computer->property-> MIME Types....
.pdf  extension is set to be with MIME type: "application/pdf". I also restarted the IIS service. Still firefox cannot show the pdf file.

Would you give some more details about correct HTTP header information of MIME type?

0
 
LVL 44

Expert Comment

by:Karl Heinz Kremer
Comment Utility
Are the PDF files stored on the server, and you just link to them, or are you either dynamically creating them, or streaming them via a server side application?

When you e.g. use PHP to generate the PDF file (or to stream it to the client), you need to add something like this to your program:

header('Content-type: application/pdf');

Every system has it's own syntax, so it depends on what you are using.

To debug the header information in Firefox install the Live HTTP Header extension: https://addons.mozilla.org/firefox/3829/
Once that is installed (and Firefox restarted), go to the Tools menu and open up the Live HTTP Headers application, then try to open your PDF document. Look for a line that starts with Content-Type: - what follows is the MIME type.
0
 

Author Comment

by:hanjgr
Comment Utility
The PDF files are already stored on the server.
I use a link <a href="help/quickref/04_Print_a_Map9x2.pdf"> in a html file to open pdf.

the html file's header includes: Content-Type: image/gif
the corrupted pdf file's header has: Content-Type:text/html

How can I change the MIME type for the pdf file?

Thanks,

0
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 
LVL 44

Expert Comment

by:Karl Heinz Kremer
Comment Utility
That's a question you need to ask to somebody who knows IIS, unfortunately that's not my area of expertise.
0
 

Author Comment

by:hanjgr
Comment Utility
I downloaded a MIME edit for firefox and added a new type: application/pdf for extension :.pdf. Still not helped.

0
 
LVL 44

Expert Comment

by:Karl Heinz Kremer
Comment Utility
It's not the client side - the wrong value gets sent by the server.
0
 

Author Comment

by:hanjgr
Comment Utility
I did it on web server and tried to open the website on the web server too.

0
 
LVL 44

Expert Comment

by:Karl Heinz Kremer
Comment Utility
You may want to crosspost this question to a IIS related group.
0
 

Accepted Solution

by:
hanjgr earned 0 total points
Comment Utility
I figured it out!
The website is managed by ServletExec. The MIME type for pdf needs to be added over there. --Set MIME Mapping.
0
 
LVL 44

Expert Comment

by:Karl Heinz Kremer
Comment Utility
The clue was clearly given during the discussion here: The MIME type for PDF files was set incorrectly on the server. You were only able to "figure it out" after the information I provided.
0
 

Author Comment

by:hanjgr
Comment Utility
Yes,
Thank khkremer very much for helping me figure out where is the problem.
You earned the credit!
0
 

Expert Comment

by:South Mod
Comment Utility
All,
 
Following an 'Objection' by khkremer (at http://www.experts-exchange.com/Q_26904677.html) to the intended closure of this question, it has been reviewed by at least one Moderator and is being closed as recommended by the Expert.
 
At this point I am going to re-start the auto-close procedure.
 
Thank you,
 
SouthMod
Community Support Moderator
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Power PDF (http://www.nuance.com/for-business/document-imaging-and-scanning/power-pdf-converter/index.htm) is the newest product from the Document Imaging division of Nuance Communications (http://www.nuance.com/). It is available in two editions — …
This article offers some helpful and general tips for safe browsing and online shopping. It offers simple and manageable procedures that help to ensure the safety of one's personal information and the security of any devices.
In this third video of the Xpdf series, we discuss and demonstrate the PDFtoText utility, which converts PDF files into plain text files. Download and install the software.: You may have already downloaded and installed the Xpdf tools while watching…
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

771 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now