How to specify parameters to google chrome adobe p

2019-01-07 14:18发布

I have an embed tag like this:

<embed src="../../Content/PDF/StockReport.pdf#zoom=50" width="100%" height="100%">

the #zoom=50 is a parameter that tells the pdf reader to zoom to 50%. This works in all browsers but google chrome because chrome has a built in pdf viewer.

How can I pass this same parameter to google chrome's pdf viewer ?

3条回答
成全新的幸福
2楼-- · 2019-01-07 14:53

Use iframe:

  1. It works in Mozilla
  2. It works in Chrome
  3. No Javascript needed

Example:

<div id="mypdf">
<iframe src="/cennik.pdf#zoom=65" style="width: 100%; height: 800px;" frameborder="0" scrolling="no">
        <p>Your web browser doesn't support iframes.</p>
   </iframe>
</div>
查看更多
手持菜刀,她持情操
3楼-- · 2019-01-07 15:03

After checking various chrome bug reports, I can confirm that Google Chrome ignores the default functionality of Adobe PDF viewer. At the time of this answer there is no way to pass parameters (like zoom) to the Chrome PDF viewer.

查看更多
家丑人穷心不美
4楼-- · 2019-01-07 15:06

It appears that a later release of Chrome may now be the answer. I had success passing zoom and page parameters through an object tag.

Case:

  • Set zoom to 200%
  • Set page to 2

Example:

<object data="https://your.url/docs/123.pdf#zoom=200&page=2" 
        type="application/pdf" 
        width="100%" 
        height="100%"> 
</object>
查看更多
登录 后发表回答