Tino
Tino

Reputation: 579

Scale PDF page sizes with screen using <object> tag

I am currently doing so like this:

<div class='embed-responsive' style='padding-bottom:150%'>
    <object data="../pdf/Invoice_file.pdf" type="application/pdf" width="95%" height="800px" 
        style="display: block; margin: 0 auto;" />
        <p>Not supported by browser.</p>
    </object>
</div>

I looked at the other solutions on here but none of them worked. If possible I'd like to scale the PDF page size as the screen gets smaller. Any ideas would be appreciated, thanks!

Upvotes: 2

Views: 957

Answers (1)

Vanquished Wombat
Vanquished Wombat

Reputation: 9525

Unless your PDF of choice has a JS interface, you may find you can't achieve what you want. Why not - well I just opened a PDF file in Chrome and resides the browser window. The PDF page in view did not scale - so I conclude that Chrome's PDF viewer is coded to re-center the page on viewport dimension changes but not to scale the page.

I your PDF viewer of choice provides a JS interface, then you probably can do it.

Problems will no doubt occur if you cannot dictate the PDF viewer your users will choose.

Upvotes: 1

Related Questions