PDF Scale for iFrame

I need to scale the PDF file to fit iFrame. It must be responsive, so the PDF must scale to the width of the device so that the PDF document displays the full page.

If Bootstrap has a free plugin or feature to do this, I'd love to hear about it.

Thanks in advance!

+12
source share
3 answers

If you ask how you can resize the PDF to fit the Iframe.

This following code may help:

<iframe src="name.pdf#zoom=50" height="100%" width="100%"></iframe> 

By adding #zoom=50 , it will show PDF with default iframe scaling. (This can be edited to any number you want)

+26
source

You probably cannot achieve this with any degree of consistency. You can have a PDF viewer in iFrame, but each viewer will behave differently while the PDF file is displayed, if the original view is not installed ... and each PDF where the initial set view may have a different zoom mode and default pages.

If you control PDF files, it’s worth setting the initial presentation, but even then you are still at the mercy of the various viewers built into browsers and browser plug-ins to determine how this initial presentation is interpreted.

+1
source

in Firefox for me it works like this, don't test it on another though

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

Source: https://habr.com/ru/post/1015099/


All Articles