[英]Why won't all the data get displayed on the browser even though all data is being displayed in console.log()?
[英]PDF won't be displayed in browser
我想在浏览器窗口中集成PDF。 我尝试了embed
和iframe
以及pdfobject.js
。 对于某些浏览器,它有效,而对于其他浏览器,则无效。
在Google Chrome浏览器中,我收到错误消息“ Error loading PDF document
(德语)”,但仅当PDF托管在我的服务器上时才出现。 如果同一PDF托管在其他地方,则可以使用。 我在HTTP响应标头中找不到重大差异。
这是我的代码,使用pdfobject.js
:
<html>
<head>
<script type="text/javascript" src="http://pdfobject.com/scripts/pdfobject.js"></script>
</head>
<body onload="ol()">
<div id="pdfRenderer" width="200" height="200"></div>
<script>
function ol() {
var pdf = new PDFObject({
//url: "http://share.rinntech.com/offerrequest/productinfo/Arbotom.pdf",
//url: "http://pdfobject.com/pdf/sample.pdf",
url: "http://share.rinntech.com/sample.pdf",
id: "pdfRendered",
pdfOpenParams: {
view: "FitH"
}
}).embed("pdfRenderer");
}
</script>
</body>
</html>
由于某些原因,此代码在jsfiddle中不起作用!
将显示PDF http://pdfobject.com/pdf/sample.pdf ,但不会显示http://share.rinntech.com/sample.pdf 。 我能做什么?
注意:在Apache中禁用Content-Disposition: attachment
无助于解决问题。
我在HTTP响应标头中找不到重大差异。
与响应标头的唯一区别是,明显地,它使您无法根据需要查看PDF:
在您的网站上
Content-Disposition: Attachment
在工作正常的网站上...没有Content-Disposition
标头
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.