Page 1 of 1

how to open a pdf file from html page??

Posted: Sat Jul 25, 2009 4:58 am
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..

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

Posted: Sat Jul 25, 2009 6:28 am
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?

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

Posted: Sat Jul 25, 2009 6:34 am
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 ' ..

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

Posted: Sat Jul 25, 2009 6:36 am
by jackpf
Then you're not linking to the right place.

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

Posted: Sat Jul 25, 2009 8:51 am
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

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

Posted: Sat Jul 25, 2009 10:01 am
by Eric!
You're doing it correctly, so your link is probably wrong, thus the message 'requested URL not found'.

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

Posted: Sat Jul 25, 2009 12:06 pm
by jackpf
What's your file structure and what's the link?

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

Posted: Sun Jul 26, 2009 1:10 am
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:

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

Posted: Sun Jul 26, 2009 7:28 am
by rrn
thanks to all those who helped me . now its working..

thank u..... :D

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

Posted: Thu Jul 30, 2009 7:30 am
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>

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

Posted: Wed Aug 05, 2009 5:42 pm
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"?

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

Posted: Thu Aug 06, 2009 8:21 am
by jackpf
Well it depends if you want to embed the pdf or link to it.

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

Posted: Fri Aug 07, 2009 9:02 am
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.