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

查看:61
本文介绍了无法在 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"

在此链接中查找附加错误错误图片.

Find attaching the error in this link Error Image.

推荐答案

当我们遇到这个问题时,能用和不能用的 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天全站免登陆