在Chrome中嵌入pdf时如何设置合适的宽度? [英] How to set fit width when embedding pdf in Chrome?

查看:510
本文介绍了在Chrome中嵌入pdf时如何设置合适的宽度?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我嵌入pdf以在Chrome/Firefox上查看时,无论我设置width/设置参数如何,它都不会更改pdf内容的宽度,我唯一能控制的就是pdf查看器的大小,而不是pdf页面大小,有什么方法可以控制吗?谢谢

When I embed a pdf to view on Chrome/ Firefox , no matter I set width / set the parameter , it does not change the width of the pdf content, the only thing I can control is the pdf viewer size but not pdf page size, are there any way to control it? thanks

<object type="application/pdf" data="2010%20AHS%20XC%20Results.pdf" width="1500" height="1200"></object>

<object type="application/pdf" data="2010%20AHS%20XC%20Results.pdf#view=fit" width="1500" height="1200"></object>

   <object type="application/pdf" data="2010%20AHS%20XC%20Results.pdf" width="1500" height="1200">
    <parm name="view" value="fit/>
</object>

以上代码均无效

推荐答案

我遇到了完全相同的问题,经过大量挖掘后发现问题出在Chrome pdf查看器.它不像Adobe那样接受URL打开参数,请参见 https://code .google.com/p/chromium/issues/detail?id = 64309 .

I had the exact same problem and found after quite a lot of digging that the problem is with the Chrome pdf viewer. It does not accept url open parameters like adobe does, see https://code.google.com/p/chromium/issues/detail?id=64309.

为了测试这一点,我在Chrome中输入了"about:plugins",禁用了Chrome pdf查看器,并启用了Adobe Reader.完成此操作后,以下代码将为我工作:

In order to test this I typed in "about:plugins" in Chrome, disabled Chrome pdf viewer and enabled the adobe viewer. Once I did this the following code worked for me:

<object type="application/pdf" data="2010%20AHS%20XC%20Results.pdf" width="1500" height="1200">
<parm name="view" value="FitH/></object>

我了解这不是真正的解决方案,因为您无法控制网站访问者是否具有此插件,但想在此处保留此答案,以便其他人在看到此信息后知道问题出在Chrome Pdf查看器从14年1月1日开始不接受URL打开参数,因此不会浪费时间寻找代码中的问题.

I understand this is not a real fix as you can't control whether the visitors to your site have this plugin or not, but wanted to leave this answer here so that others who see this post know that the issue is with Chrome Pdf viewer not accepting URL open parameters as of 11/21/14 and so will not waste their time looking for issues in their code.

这篇关于在Chrome中嵌入pdf时如何设置合适的宽度?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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