i want to display pdf file in my web, but my script is not working. here it is the script: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>Untitled Document</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body> <INPUT id="btnopen" type="button" value="open report" name="Button1" onclick="location.href='pdf-php-tutorial-06.pdf'"> </body> </html> this one is the another one: <html> <head> <script type="text/javascript"> function showHideElement(element){ var elem = document.getElementById(element); if (elem.style.display=="none"){ elem.style.display="block" } else{ elem.style.display="none" } } </script> </head> <body> <div style="position:absolute;height:100px;width:100px;background-color:Yellow;" onclick="showHideElement('Iframe1');">click me</div> <div style="position:absolute;z-index:100;background-color:Green;height:100px;width:100px;margin-left:200px;"></div> <div style="position:absolute;z-index:20;margin-left:200px;"> <iframe visible="true" id="Iframe1" height="100" width="100" runat="server" frameborder="0" scrolling="auto" > </iframe> </div> <div style="position:absolute;z-index:10;margin-left:100px;"> <iframe visible="true" id="ipdf" src="pdf-php-tutorial-06.pdf" height="1000" width="1000" runat="server" frameborder="0" scrolling="auto" > </iframe> </div> </body> </html> both of that script is not working, please help me to fix it..!
are you trying to embed a pdf in your site? i.e. not as a download? what server you running apache or windows?
Hi use this line, replace FILENAME with your file name and play with the zeros to hide/display controls. <embed src="FILENAME.pdf#toolbar=0&navpanes=0&scrollbar=0" width="500" height="375">
From a usability standpoint I would suggest you use a standard <a href> link to the pdf. With more and more eBooks these days, users may just decide to download it and read it on the train/bus. If you use an embed tag then you're requiring users who want to download your pdf to know how to view source and find the correct link to download. Besides, most browser know what application to use when opening a pdf anyway. Just my 2-cents...
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>Untitled Document</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body> <INPUT id="btnopen" type="button" value="open report" name="Button1" onclick="location.href='pdf-php-tutorial-06.pdf'"> </body> </html> this one is the another one: <html> <head> <script type="text/javascript"> function showHideElement(element){ var elem = document.getElementById(element); if (elem.style.display=="none"){ elem.style.display="block" } else{ elem.style.display="none" } } </script> </head> <body> <div style="position:absolute;height:100px;width:100px;background-color:Yellow;" onclick="showHideElement('Iframe1');">click me</div> <div style="position:absolute;z-index:100;background-color:Green;height:100px;width:100px;margin-left:200px;"></div> <div style="position:absolute;z-index:20;margin-left:200px;"> <iframe visible="true" id="Iframe1" height="100" width="100" runat="server" frameborder="0" scrolling="auto" > </iframe> </div> <div style="position:absolute;z-index:10;margin-left:100px;"> <iframe visible="true" id="ipdf" src="pdf-php-tutorial-06.pdf" height="1000" width="1000" runat="server" frameborder="0" scrolling="auto" > </iframe> </div> </body> </html> can you fix it?
Hi both codes works fine here, are you sure you put the PDF file in the same directory as the HTML file? are you using apache server on your PC or real internet server? can you point me to your site? (you can send me a private message if you like) anyway, I have these two options: (I didnt understand what you tried to do in the second code so I made it simpler) option 1: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> </head> <body> <INPUT id="btnopen" type="button" value="open report" name="Button1" onclick="location.href='pdf-php-tutorial-06.pdf'"> </body> </html> option 2: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> </head> <body> <embed src="pdf-php-tutorial-06.pdf#toolbar=1&navpanes=0&scrollbar=1" width="1000" height="1000"> </body> </html>