Reputation: 328
I am building a page that will display a PDF file on the page. When viewing this page in Chrome, the zoom level is set by default so that the document is wider and taller than the allotted space. Safari seems to have a preferable default of fitting the page to the available space, just FYI.
I would like to know if there are any parameters that can be set in <object>
to force the initial zoom level of the document. It might be name=initZoom with values like "fitToPage" or "fitToWidth" or "70" (for 70% zoom). It might look something like this:
<object data="/path/to/file.pdf" type="application/pdf">
<param name="initZoom" value="fitToPage" />
</object>
Upvotes: 13
Views: 43817
Reputation: 107
Another late answer (looks like we're on a 2-year cycle...)
I found that setting the parameter #zoom=Fit
finally did the trick. This is only in FF so far. Chrome is laughing at every parameter I feed it.
Note that the documentation states that view
gets the Fit
values, but zoom
is the one that seems to do anything with them.
I hope this helps someone down the line.
Upvotes: 1
Reputation: 41
Adding a late answer since none of the existing ones worked for me, and someone might need it.
Instead of adding '#view=fitH' or '#view=fitV' to the pdf url, which didn't work for me, i got it working by adding '#zoom=scale', like this:
<object data="/path/to/file.pdf#zoom=scale" type="application/pdf">
</object>
Hope this helps someone, and sorry for any inconvenience.
EDIT: Found more parameters here. Found the link in this thread, which is basically the same question as this.
Upvotes: 4
Reputation:
See demo here http://jsfiddle.net/6TNrw/68/
The above works if the pdf viewer object is adobe.
Google chrome has its own pdf viewer so changing its zoom parameter wont work for that.
<object data="http://www.nclabor.com/wh/faqs.pdf?#view=fitH"
type="application/pdf"
width="100%" height="100%">
<param name="view" value="fitH" />
</object>
Upvotes: 5
Reputation: 90213
Does Adobe's document 'Parameters for opening PDF files' help you?
According to that document, something like
<object data="/path/to/file.pdf" type="application/pdf">
<param name="view" value="Fit" />
</object>
could work, or even
<object
data="/path/to/file.pdf#toolbar=1&navpanes=0&scrollbar=1&page=3&view=FitV"
type="application/pdf">
<p>It appears you don't have a PDF plugin for this browser.
No problem though...
You can <a href="/path/to/file.pdf">click here to download the PDF</a>.
</p>
</object>
Upvotes: 11