how to open a pdf file from html page??

HTML, CSS and anything else that deals with client side capabilities.

Moderator: General Moderators

Post Reply
rrn
Forum Commoner
Posts: 46
Joined: Wed Apr 15, 2009 7:54 am

how to open a pdf file from html page??

Post by rrn »

i am creating a website in html page , i want to open a pdf file from my html page..
ie in my website there is a link to location map, wen i click the the 'location map ' , a pdf file should be opened.. tried a lot of ways, pls help me..

Code: Select all

<font color="#0000FF"><p align="center"><a href = 'map.pdf'>Location map</a></p></font>
will the above code work???

any help will be appreciated..
User avatar
kaszu
Forum Regular
Posts: 749
Joined: Wed Jul 19, 2006 7:29 am

Re: how to open a pdf file from html page??

Post by kaszu »

If users have Adobe Reader installed, then it should work, if they won't then they will be offered to download that file.
It doesn't work?
rrn
Forum Commoner
Posts: 46
Joined: Wed Apr 15, 2009 7:54 am

Re: how to open a pdf file from html page??

Post by rrn »

no , it is not working..
i tried the folloing code

Code: Select all

<HTML>
<HEAD>
 
 <script type="text/javascript">
function open_win()
{
window.open("http://wwwtest.com/map.pdf","_blank");
}
</script>
</HEAD>
<form>
<input type="button" onclick="open_win()" value="Location map">
</form>
</BODY>
</HTML>
this is also not working..
wen i click the button , a new window is opened but it is displaying a message ' requested URL not found ' ..
User avatar
jackpf
DevNet Resident
Posts: 2119
Joined: Sun Feb 15, 2009 7:22 pm
Location: Ipswich, UK

Re: how to open a pdf file from html page??

Post by jackpf »

Then you're not linking to the right place.
rrn
Forum Commoner
Posts: 46
Joined: Wed Apr 15, 2009 7:54 am

Re: how to open a pdf file from html page??

Post by rrn »

i am sure that i am linking to the correct place...

is ther any other way to do that...

:banghead:

pls give a solution
Eric!
DevNet Resident
Posts: 1146
Joined: Sun Jun 14, 2009 3:13 pm

Re: how to open a pdf file from html page??

Post by Eric! »

You're doing it correctly, so your link is probably wrong, thus the message 'requested URL not found'.
User avatar
jackpf
DevNet Resident
Posts: 2119
Joined: Sun Feb 15, 2009 7:22 pm
Location: Ipswich, UK

Re: how to open a pdf file from html page??

Post by jackpf »

What's your file structure and what's the link?
rrn
Forum Commoner
Posts: 46
Joined: Wed Apr 15, 2009 7:54 am

Re: how to open a pdf file from html page??

Post by rrn »

file is a pdf file ..

the link is

Code: Select all

<p align="center"><a href='map.pdf'>Location map</a></p>
wen i click the link it is displaying " webpage cannot be found" :crazy:
rrn
Forum Commoner
Posts: 46
Joined: Wed Apr 15, 2009 7:54 am

Re: how to open a pdf file from html page??

Post by rrn »

thanks to all those who helped me . now its working..

thank u..... :D
User avatar
Sindarin
Forum Regular
Posts: 521
Joined: Tue Sep 25, 2007 8:36 am
Location: Greece

Re: how to open a pdf file from html page??

Post by Sindarin »

Also don't forget you can embed a pdf document in the page using the <object> tag:

Code: Select all

<object height="600" width="500" type="application/pdf" data="http://www.test.com/mydocument.pdf" border="0" standby="Loading..." codebase="http://get.adobe.com/reader/">
<param name="src" value="http://www.test.com/mydocument.pdf" />
You need Adobe Reader to be able to view this document.
</object>
puncha
Forum Newbie
Posts: 2
Joined: Wed Aug 05, 2009 5:36 pm

Re: how to open a pdf file from html page??

Post by puncha »

Sindarin wrote:Also don't forget you can embed a pdf document in the page using the <object> tag:

Code: Select all

<object height="600" width="500" type="application/pdf" data="http://www.test.com/mydocument.pdf" border="0" standby="Loading..." codebase="http://get.adobe.com/reader/">
<param name="src" value="http://www.test.com/mydocument.pdf" />
You need Adobe Reader to be able to view this document.
</object>
I've never used this code. Is it better than using " a href="http://www.test.com/mydocument.pdf"?
User avatar
jackpf
DevNet Resident
Posts: 2119
Joined: Sun Feb 15, 2009 7:22 pm
Location: Ipswich, UK

Re: how to open a pdf file from html page??

Post by jackpf »

Well it depends if you want to embed the pdf or link to it.
padmanaban
Forum Newbie
Posts: 4
Joined: Fri Aug 07, 2009 8:25 am

Re: how to open a pdf file from html page??

Post by padmanaban »

Thanks for all. I too experienced the same problem and after seeing this post my problem was resolved. In that, embedded the pdf file by the object tag is the one i using now.
Post Reply