I've been struggling to find a workable way to imbed .pdf files in web pages that are broadly accessible, including to IE8 users. I don't think pdf.js is going to work because I want to embed the files, not load them as new pages.PDFObject seems like the best choice. But when I use their code, no matter what browser I use, I get only about a quarter of the page length displaying, as shown in the accompanying image. Everything below that first line of text is simply the white of my website background. I have tried both following the PDFObject instructions and using their code generator. No luck either way. Here's the code:
<!-- insert in the document body -->
<object data='http://www.example.com/TestDoc.pdf#'
type='application/pdf'
width='100%'
height='100%'>
<p>It appears your Web browser is not configured to display PDF files.
No worries, just <a href='http://www.chrisrichard.org/TestDoc.pdf'>click here to download the PDF file.</a></p>
</object>
And here's the javascript version:
<!-- insert in the document head -->
<script type='text/javascript'>
function embedPDF(){
var myPDF = new PDFObject({
url: 'http://www.example.com/TestDoc.pdf'
}).embed();
}
window.onload = embedPDF; //Feel free to replace window.onload if needed.
</script>
This is all directly from the PDFObject coder. There's a tutorial on the website, and I've followed it meticulously so far as I can tell, but no luck. So I'm stumped, and would appreciate any suggestions. Frankly, I wish I didn't have to accomodate IE8 at all, and I wish I could make pdf.js work for what I want it to do, but neither seems to be a viable option. Again, thanks in advance for any ideas.
Note: Please note corrected code, which gives the entirety of what PDFObject generates.
Note 2: This is the entirety of the kind of page I would be seeking to insert the viewer into. I have skipped the javascript version, which would have me insert the code in the header and which would fill the entire page with the pdf and viewer. It's important that the .pdf be set within my page. I would almost certainly be getting rid of the swfobject references, since that isn't working with mobile devices, etc.
<!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>example.com - </title>
<link href="oneColLiqCtrHdr.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
#MenuHolder {
position:absolute;
left:692px;
top:50px;
width:228px;
height:23px;
z-index:1;
}
-->
</style>
<script src="Scripts/swfobject_modified.js" type="text/javascript"></script>
<body class="oneColLiqCtrHdr">
<div id="container">
<div id="header">
<h1><img src="images/BodyLogo.jpg" width="665" height="57" alt="Logo" /></h1>
<link type="text/css" rel="stylesheet" href="/floatbox/floatbox.css" />
<script type="text/javascript" src="/floatbox/floatbox.js"></script>
<script type="text/javascript" src="/floatbox/options.js"></script>
<link rel="stylesheet" href="/Menu2Assets/mbcsmb4pc8.css" type="text/css" />
<div id="mb4pc8ebul_wrapper" style="max-width: 345px;">
<ul id="mb4pc8ebul_table" class="mb4pc8ebul_menulist css_menu">
<li><div class="arrow buttonbg"><a>Examples</a></div>
<ul>
<li><a href="Example1.html" target="_self" title="">Example1</a></li>
<li><a href="Example2.html" target="_self" title="">Example2</a></li>
<li><a href="Example3.html" target="_self" title="">Example3</a></li>
<li><a href="Example4.html" target="_self" title="">Example4</a></li>
</ul></li>
<li><div class="buttonbg" style="width: 86px;"><a href="resume.html" target="_parent" class="button_2">Resume</a></div></li>
<li><div class="arrow buttonbg" style="width: 96px;"><a>Contact</a></div>
<ul>
<li><a href="Mail/contactform.php" class="floatbox" data-fb-options="width:50% height:80% scrolling:yes" title="">Email</a></li>
<li><a href="files/index.php" class="floatbox" data-fb-options="width:50% height:80% scrolling:yes" title="">Send</a></li>
</ul></li>
<li><div class="buttonbg" style="width: 69px;"><a href="index.html" target="_self" class="button_4">Home</a></div></li>
</ul>
</div>
<script type="text/javascript" src="/Menu2Assets/mbjsmb4pc8.js"></script>
<!-- end #header --></div>
</head>
<div id="mainContent">
<p align="center"> </p>
<p align="center"> </p>
<p align="center"> </p>
<!-- insert in the document body -->
<object data='http://www.example.com/TestDoc.pdf#'
type='application/pdf'
width='100%'
height='100%'>
<p>It appears your Web browser is not configured to display PDF files.
No worries, just <a href='http://www.example.com/TestDoc.pdf'>click here to download the PDF file.</a></p>
</object>
<p align="center"> </p>
<p align="center"> </p>
</div>
<div id="footer">
<p align="center"><img src="images/Copyright.jpg" width="190" height="15" alt="Copyright" /></p>
<!-- end #footer --></div>
<!-- end #container --></div>
</body>
</html>
`, then an `- ` and then an unclosed `
` tag with the pdf file. Every single line in the code makes a huge difference in this case.