我是公司的网站开发人员
从本周开始,我和网络客户的所有同事都无法打开嵌入式pdf数据
我们传输数据协议的方式,数据:application / pdf示例可以在plunker http://embed.plnkr.co/Bjkypkht4RjIWE1AyFP0/index.html中找到
不久,我们将数据放入数据:application / pdf并使用window.open()方法在浏览器中打开pdf二进制数据。
这个功能在本周之前正常工作,它实际上已经在IE / Firefox / Chrome浏览器中使用pdf附加组件或查看器插件工作了将近一年。
但本周开始,所有IE版本都不再起作用,错误显示如下,有谁可以帮我找出原因?
Error displayed by IE: The webpage cannot be displayed Most likely cause: Some content or files on this webpage require a program that you don't have installed.
请不要告诉我重置IE或启用/禁用IE,所有这些方法都已经过我们的尝试但是没有用。感谢
。
Operating System: Windows 7 Professional 64 bit IE11(take this as an example): Version: 11.0.9600.17728 Update Versions: 11.0.18(KB3038314) Adobe PDF: Name: Adobe PDF Reader Publisher: Adobe Systems, Incorporated Type: ActiveX Control Architecture: 32-bit and 64-bit Version: 11.0.10.32 File date: Tuesday, December 02, 2014, 10:31 PM Date last accessed: Today, June 04, 2015, 2 hours ago Class ID: {CA8A9780-280D-11CF-A24D-444553540000} Use count: 1 Block count: 0 File: AcroPDF64.dll Folder: C:\Program Files (x86)\Common Files\Adobe\Acrobat\Active
答案 0 :(得分:0)
这是我使用javascript验证的代码段。
//create a Blob with an array and the optional dictionary object.
var TEST_PDF_DATA = data;
var byteCharacters = atob(TEST_PDF_DATA);
var charCodeFromCharacter = function(c) { return c.charCodeAt(0); }
var byteArrays = [];
for (var offset = 0; offset < byteCharacters.length; offset += 1000)
{
var slice = byteCharacters.slice(offset, offset + 1000);
var byteNumbers = Array.prototype.map.call(slice, charCodeFromCharacter);
byteArrays.push(new Uint8Array(byteNumbers));
}
var blob1 = new Blob(
byteArrays, //array
{ type: "application/pdf"} //dictionary object
);
//create a second blob that uses the first blob in its array
var blob2 = new Blob([blob1, "Those who understand binary and those who don't."]);
// Save the blob2 content to a file, giving both "Save" *and* "Open" options
window.navigator.msSaveOrOpenBlob(blob2, 'msSaveBlobOrOpenBlob_testFile.pdf');
alert('File saved using msSaveOrOpenBlob() - note the two "Open" and "Save" buttons below.');