如何在mobile safari中设置pdf宽度
我正在尝试显示嵌入网页中的 pdf 文件。我正在使用
<object id="objectPDF" type="application/pdf" data="pdf.pdf" width="100%" height="1000px" style="border:2px solid red; text-align:center">
<param name="view" value="fitH" valuetype="data"/>
I am trying to display a pdf file embed in a webpage. I am using the <object>
tag. The pdf can be displayed in iphone or ipad. However, I want to make the pdf display fill the full width of the webpage. I am unable to find out any document about setting the pdf width for mobile safari. Please help
<object id="objectPDF" type="application/pdf" data="pdf.pdf" width="100%" height="1000px" style="border:2px solid red; text-align:center">
<param name="view" value="fitH" valuetype="data"/>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
你可能想把它放在一个 div 中并取出对象标签中的宽度,
you might want to put it an a div and take out the width in the object tag,
仅从外观来看,我认为如果关闭
元素,它应该可以工作。
为什么使用宽度和高度作为对象属性?我只会使用 css 来实现它。我认为这
对于
@LG PDF 和 @Trevor Rudolph:您的
这可能也与 pdf 插件有关。这是有效的。我通过 Safari 上的屏幕截图服务进行了测试,但移动设备则是另一回事。边境呢?你可以看到它显示出来了吗?
CSS:
HTML:
我用 flash 对象测试了它。顺便说一句,不需要包装。对象将采用 W x H,例如
有效。
Just from looking at it I'd say it should work if you close the
</object>
element.Why do you use width and height as object attributes? I would just use css for it. And I don't think that
is approriate for an
<object>
since this is not HTML-rendered. Inside i'ts just a plugin. Maybe that's another thing that could break it.And @LG PDF and @Trevor Rudolph: your
<object>
never closes! Maybe that's why safari does it not right?This might have to do something with the pdf plugin as well. Here is what works. I tested it through the screenshot service on Safari, but mobile is another thing. What about the border? You can see it show up right?
CSS:
HTML:
I tested it with a flash object. No wrapper needed, btw. Object would take W x H, e.g.
<div>
works.使用对象时,对我来说没有任何作用。如果改用 iframe,并应用适当的缩放,它就可以工作。无论如何都不完美。
Nothing works for me when using object. If iframe is used instead, and proper scaling is applied, it works. Not perfect anyway.