缩放以适合:嵌入在 HTML 中的 PDF [英] Zoom to fit: PDF Embedded in HTML

查看:36
本文介绍了缩放以适合:嵌入在 HTML 中的 PDF的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将一个本地 pdf 文件嵌入到一个简单的网页中,并且我希望设置初始缩放以适应对象大小.这是我尝试过的,但不影响缩放.

 

有谁知道如何修改代码,以便将其初始缩放设置为适合对象大小.

解决方案

有点晚了,但我注意到这个信息很难找到,而且还没有在 SO 上找到答案,所以在这里.

尝试不同的参数 #view=FitH 以强制它适合水平空间,并且您还需要以 # 而不是 & 开始查询字符串.制作它:

filename.pdf#view=FitH

我注意到,如果 adobe reader 嵌入在浏览器中,这将起作用,但 chrome 将使用它自己的阅读器版本,并且不会以相同的方式响应.在我自己的例子中,chrome 浏览器默认缩放以适应宽度,所以没问题,但 Internet Explorer 需要上述参数以确保链接始终以正确的视图设置打开 pdf 页面.

有关可用参数的完整列表,请参阅此

I am embedding a local pdf file into a simple webpage and I am looking to set the initial zoom to fit to the object size. Here is what I tried but it is not affecting the zoom.

 <embed src="filename.pdf?zoom=50" width="575" height="500">

does anyone know how to modify the code so its initial zoom is set to fit the object size.

解决方案

Bit of a late response but I noticed that this information can be hard to find and haven't found the answer on SO, so here it is.

Try a differnt parameter #view=FitH to force it to fit in the horzontal space and also you need to start the querystring off with a # rather than an & making it:

filename.pdf#view=FitH

What I've noticed it is that this will work if adobe reader is embedded in the browser but chrome will use it's own version of the reader and won't respond in the same way. In my own case, the chrome browser zoomed to fit width by default, so no problem , but Internet Explorer needed the above parameters to ensure the link always opened the pdf page with the correct view setting.

For a full list of available parameters see this doc

EDIT: (lazy mode on)

这篇关于缩放以适合:嵌入在 HTML 中的 PDF的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆