PDF中的%% EOF是否必须出现在文件的最后1024个字节内? [英] Does the %%EOF in a PDF have to appear within the last 1024 bytes of the file?

查看:839
本文介绍了PDF中的%% EOF是否必须出现在文件的最后1024个字节内?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

根据 QPDF 的来源,我在阅读中引用了有关pdf的报价:

According to the QPDF source I was reading it had this quote about pdfs:

// PDF spec says %%EOF must be found within the last 1024 bytes of
// the file.  We add an extra 30 characters to leave room for the
// startxref stuff.

但是,我在PDF 1.7规范中找不到与此有关的任何信息.我在互联网上发现了几个也提到了这一点的地方.

However, I cannot find any information regarding this in the PDF 1.7 specification. I found a couple places on the internet that also mentioned this though.

我的问题是:这是真的吗?如果是,那么在哪里指定%%EOF将在最后1024个字节中?

My question is: is this true and if so, where is this specified that %%EOF will be in the last 1024 bytes?

推荐答案

源代码确实在libqpdf/QPDF.cc中说了这一点,但是ISO 32000-1:2008(PDF 1.7版)对此文件有此说法.拖车:

The source code does indeed say that, in libqpdf/QPDF.cc, but ISO 32000-1:2008 (the PDF 1.7 one) has this to say about the file trailer:

7.5.5.文件预告片

PDF文件的预告片使符合要求的阅读器可以快速找到交叉引用表和某些特殊对象.合格的读者应从文件末尾阅读PDF文件.文件的最后一行应仅包含文件结尾标记 %% EOF .

The trailer of a PDF file enables a conforming reader to quickly find the cross-reference table and certain special objects. Conforming readers should read a PDF file from its end. The last line of the file shall contain only the end-of-file marker, %%EOF.

因此,如果您遵循标准,那么它比您规定的要严格得多.

So, if you're following the standard, it's even more restrictive than you state.

在Adobe 1.3规范的附录H(实施说明)中,您将找到有关Acrobat查看器属性(而不是文件格式)的以下小片段:

Back in the Adobe 1.3 specification, in Appendix H (Implementation notes), you'll find this little snippet about the properties of the Acrobat viewer (not the file format):

3.4.4,文件预告片"

Acrobat查看器仅要求%% EOF标记出现在文件的最后1024个字节内.

Acrobat viewers require only that the %%EOF marker appear somewhere within the last 1024 bytes of the file.

换句话说,就是说,查看器(Adobe的实现)在接受内容方面稍微放松了一些.但是,规范本身仍然坚持%%EOF必须独立存在,最后一行.

In other words, it's saying that the viewer (Adobe's implementation) is a little more relaxed in what it will accept. The specification itself, however, still maintains that the %%EOF has to be on its own, on the last line.

该注释 still 在Adobe的1.7版本文件格式文档中存在.但是,它已从ISO版本中删除,因为正确的是,ISO并不关心产品的特定实现,只要它们符合书面标准即可.

That note still exists in Adobe's version of the file format document up to 1.7. However, it was removed from the ISO version since, rightly so, ISO don't care one little bit about specific implementations of a product, as long as they conform to the standard as written.

可以在此处找到Adobe的文档,它们也有权分发(稍作修改) ISO 32000标准的版本此处.

Adobe's documents can be found here, they also have the right to distribute a (slightly modified) version of the ISO 32000 standard here.

这篇关于PDF中的%% EOF是否必须出现在文件的最后1024个字节内?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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