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>
Using an iframe tag is the second way to embed a pdf file in an HTML web page. In web development, web developers use the iframe tag to embed files in various formats and even other websites within a web page. Due to its wide compatibility, the iframe tag is widely used for embedding pdf.
I'll keep this quick. All you need to do is add #view=fitH to the end of the source attribute. That's it!
The easiest way to put PDF in an HTML document is using the <a> tag with its href attribute. You need to add the URL or the reference link of your PDF file to the element.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With