Zoom to Fit: Pdf Embedded in HTML

Default zoom for embedded PDF in Edge

Looks like it is not possible to zoom the embedded PDF for MS Edge (EDGE HTML) browser.

If you are available to use MS Edge (Chromium) browser then you can zoom the PDF by adding the zoom argument to file name.

 <embed width="500" height="800" src="http://www.africau.edu/images/default/sample.pdf?#zoom=120" type="application/pdf"></embed>

Example:

 <!DOCTYPE html>
<html>
<head>
<title>Title of the document</title>
</head>
<body>
<iframe width="500" height="800" src="http://www.africau.edu/images/default/sample.pdf?#zoom=120"></iframe>
<object width="500" height="800" data="http://www.africau.edu/images/default/sample.pdf?#zoom=120" type="application/pdf"></object>
<embed width="500" height="800" src="http://www.africau.edu/images/default/sample.pdf?#zoom=120" type="application/pdf"></embed>
</body>
</html>

Output in MS Edge (Chromium) browser:

enter image description here

How can I force an embeded PDF to display at Page Width zoom level?

Most PDF settings are browser specific and subject to user control so here a Chrome based Edge (on the left) and a Firefox based clone (on the right) the biggest problem noticed in these four types of loading is the lack of object support (totally missing in bottom right). Note:- I have security set so only the high speed secured Firefox based plugin viewer will show me PDFs inline without risk of running a script.

However in direct answer to the question not all browsers support the acrobat#tags but most will attempt #zoom=50% (and #page= except perhaps Safari?) whereas fit has frequently been an odd behaviour difference between all of the camps. I show the chrome result below.

Sample Image

the correct tag could be #FitW and that's what I used when chrome unsecured viewing is turned on
Sample Image

How to set fit width when embedding pdf in Chrome?

I had the exact same problem and found after quite a lot of digging that the problem is with the Chrome pdf viewer. It does not accept url open parameters like adobe does, see https://code.google.com/p/chromium/issues/detail?id=64309.

In order to test this I typed in "about:plugins" in Chrome, disabled Chrome pdf viewer and enabled the adobe viewer. Once I did this the following code worked for me:

<object type="application/pdf" data="2010%20AHS%20XC%20Results.pdf" width="1500" height="1200">
<parm name="view" value="FitH" /></object>

I understand this is not a real fix as you can't control whether the visitors to your site have this plugin or not, but wanted to leave this answer here so that others who see this post know that the issue is with Chrome Pdf viewer not accepting URL open parameters as of 11/21/14 and so will not waste their time looking for issues in their code.



Related Topics



Leave a reply



Submit