This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes HTML, CSS and JavaScript and the fly likes Opening pdf from html Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Opening pdf from html" Watch "Opening pdf from html" New topic

Opening pdf from html

Amruta Deo

Joined: Sep 10, 2004
Posts: 8
I have a pdf file which I am trying to open from an html page (after clicking on a link). If both the html and pdf are kept on a WINDOWS machine, the pdf opens correctly in the adobe reader embedded in a browser (IE) but if both these files are kept on a UNIX machine, the pdf opens as a ASCII file (having all ASCII characters, looks like garbage data) in the browser.

Firstly I thought the file must be corrupt but when I transferred that file to a WINDOWS machine, it's opening correctly. Also I have made sure that the file is transferred to UNIX machine in BINARY mode.

Can anybody tell me what could be the possible reasons of this problem?

Thanks and regards,
Amruta Deo
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 61066

It's likely that the browser you are using on the unix box doesn't have a mime mapping for pdf.

What happens when you try to access the pdf served from windows with the unix browser? And vice versa? This is a basic debugging step you should already have tried.

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Amruta Deo

Joined: Sep 10, 2004
Posts: 8
It's not possible that the mime type is not set for browser because when I try to open the other PDF files on the same UNIX machine (rather the same folder) from browser, they open correctly. Only that particular file has problems opening.

Thanks and regards,
Amruta Deo
I agree. Here's the link:
subject: Opening pdf from html