Scale PDF to fit iFrame

29,885

Solution 1

in firefox for me it work like this, dont test it on other though

<iframe src="filename.pdf#zoom=FitH" style="position:absolute;right:0; top:0; bottom:0; width:100%;"></iframe>

Solution 2

You probably won't be able to achieve this with any degree of consistency. You will be able to have the PDF viewer in the iFrame be responsive but each viewer will behave differently as far as displaying the PDF if no initial view is set... and each PDF where the initial view is set may have a different default zoom and page mode.

If you are in control of the PDF files, it's worth setting the initial view but, even then, you are still at the mercy of the different viewers built into the browsers and browser plug-ins to determine how that initial view is interpreted.

Share:
29,885
Luuxter
Author by

Luuxter

Updated on July 23, 2022

Comments

  • Luuxter
    Luuxter almost 2 years

    I need to scale a PDF file to fit the iFrame. It needs to be responsive, so the PDF should scale with the device width so that the PDF document displays a complete page.

    If there is a free plugin or a function in Bootstrap to make this happen, I would be happy to hear about it.

    Thanks in advance!