John John - 4 years ago 70
Javascript Question

Javascript won't change pages in PDF or Zoom

I'm using Windows 10 and I have a file called

pdf.html
on my Desktop.

The contents of
pdf.html
is.

<!DOCTYPE html>
<html>
<head>
<script type="text/javascript">

function goAndZoom(pageNum,zoom)
{
var pdf = document.getElementById('pdf');
pdf.data = pdf.data+'#page='+pageNum+'&zoom='+zoom;
document.body.removeChild(pdf);
document.body.appendChild(pdf);
}
</script>
</head>
<body>
<button onclick="goAndZoom(4,300);">Go to Page 4 and zoom 300%</button>
<object id="pdf" data="http://www.adobe.com/content/dam/Adobe/en/devnet/acrobat/pdfs/pdf_open_parameters.pdf" width="100%" height="700px" type="application/pdf">
<param name="zoom" value="100" />
</object>

</body>
</html>


I open this file in Chrome. When I press the button "Go to page 4 and zoom 300%", the embedded pdf will go to page 4 and zoom 300%. When I repeat these two actions in Edge browser, the pdf stays on page 1 without altering the zoom. I have shared this
pdf.html
file with other people and they reported the same problem when using IE 11.

How do I get the
goAndZoom()
function to go to a page in a PDF and zoom in IE and Edge?

Answer Source

No solution exists as of April 27, 2016

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download