无法在Chrome中加载PDF文档 [英] Failed to load PDF document in Chrome

查看:1097
本文介绍了无法在Chrome中加载PDF文档的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的服务器上存储了一个PDF文件.我无法通过URL "sitename/pdfName.pdf" 使用Google Chrome(或Ubuntu Chromium)访问文件;我可以在Internet Explorer或FireFox中访问相同的PDF,而不会出现任何问题.

I have a PDF file stored on my server. I am unable to access the file using Google Chrome (or Ubuntu Chromium) via URL "sitename/pdfName.pdf"; while I am able to access the same PDF in Internet Explorer or FireFox without a problem.

Chrome出现此错误:无法加载PDF文档"

Chrome is giving this error: "Failed to load PDF document"

在此链接中找到错误错误图片.

推荐答案

当我们遇到此问题时,起作用和不起作用的PDF文件之间的唯一区别是PDF文档本身的第一行. 这是导致错误的旧PDF与固定版本之间的区别,如在启用了二进制文件的文本编辑器(在本例中为vim -b)中所见:

When we encountered this problem, the only difference between PDF files that did and did not work was in the fist line of the PDF document itself. Here's the difference between the old PDF that caused the error and the fixed version as seen in a binary-enabled text-editor (in this case vim -b):

原始PDF文件:

%PDF-1.6^M%<e2><e3><cf><d3>^M

修复的PDF文件:

%PDF-1.6^M
%<e2><e3><cf><d3>^M

因此问题从根本上得到解决,无需再为受害者安装额外的软件或重新安装chrome.

So the problem was solved at the source, no need to burden the victims with installing extra software or reinstalling chrome.

我不知道这是PDF生成器还是chrome插件出现问题. 根据PDF规范,PDF文档的第一行必须包含PDF版本,但是对于^ M是否为有效的行分隔符,我还是不太清楚.

I don't know if this is a problem with the PDF generator, or with the chrome plugin. According to the PDF specification the first line of a PDF document has to contain the PDF version, but it's not completely clear to me if the ^M is a valid line separator.

这篇关于无法在Chrome中加载PDF文档的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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