使用对象标签在PDF中嵌入PDF文件 [英] embed PDF file in html using object tag

查看:134
本文介绍了使用对象标签在PDF中嵌入PDF文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将pdf文档嵌入到我的html代码中。

 <!DOCTYPE HTML PUBLIC -  // W3C // DTD HTML 4.01 Transitional / / ENhttp://www.w3.org 

/TR/html4/loose.dtd\">
< html lang =en>
< head>
< meta http-equiv =Content-Typecontent =text / html; charset = UTF-8>
< title>< / title>
< / head>
< body>
< object height =100%width =100%type =application / pdfdata =yii.pdf#toolbar = 1& amp; navpanes = 0& amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; ;页= 1&放大器;放大器;图= FITH>

< p>看起来你没有这个浏览器的PDF插件。没什么大不了......你可以点击这里下载PDF文件。< / a>< / p>

< / object>

< / body>
< / html>

但是结果是FF4上的空白页面,IE9嵌入了pdf文件,但其容器几乎是30%的页面。如果我删除第一行,即DOCTYPE,那么这两个浏览器都会呈现pdf文件。
以下代码正常工作。

 < html lang =en> 
< head>
< meta http-equiv =Content-Typecontent =text / html; charset = UTF-8>
< title>< / title>
< / head>
< body>
< object height =100%width =100%type =application / pdfdata =yii.pdf#toolbar = 1& amp; navpanes = 0& amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; ;页= 1&放大器;放大器;图= FITH>

< p>看起来你没有这个浏览器的PDF插件。没什么大不了......你可以点击这里下载PDF文件。< / a>< / p>

< / object>

< / body>
< / html>

我想在我的页面中使用doctype,以便其他页面正常工作。有没有办法解决第一个包含doctype的代码? 我会试着用< iframe> 元素。

如果没有,也许将其转换为flash并嵌入闪光灯。

<!doctype html> 并查看它的作用,这是HTML5的标准doctype


I m embeding a pdf document into my html code. For this i have wrote this code.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org

/TR/html4/loose.dtd">
<html lang="en">
<head>
    <meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
    <title></title>
</head>
<body>
<object height="100%" width="100%" type="application/pdf" data="yii.pdf#toolbar=1&amp;navpanes=0&amp;scrollbar=1&amp;page=1&amp;view=FitH">

<p>It appears you don't have a PDF plugin for this browser. No biggie... you can <a href="/pdf/sample.pdf">click here to download the PDF file.</a></p>

</object>

</body>
</html>

But result is empty page on FF4 and IE9 embeds pdf file but its container is very small almost 30% of page. if I remove first line i.e DOCTYPE both browsers renders pdf file as it should. Following code works fine.

<html lang="en">
<head>
    <meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
    <title></title>
</head>
<body>
<object height="100%" width="100%" type="application/pdf" data="yii.pdf#toolbar=1&amp;navpanes=0&amp;scrollbar=1&amp;page=1&amp;view=FitH">

<p>It appears you don't have a PDF plugin for this browser. No biggie... you can <a href="/pdf/sample.pdf">click here to download the PDF file.</a></p>

</object>

</body>
</html>

I want to use doctype in my page so that other pages work fine. Is there a way to fix first code that contains doctype?

解决方案

I would try with an <iframe> element.
If not, maybe transforming it into flash and then embedding the flash.

Also, try <!doctype html> and see what it does, that's the standard doctype for HTML5

这篇关于使用对象标签在PDF中嵌入PDF文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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