根据QPDF我正在阅读的来源有关于 pdf 的引用:
// 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 规范中找不到任何关于此的信息。我在互联网上找到了几个地方也提到了这一点。
我的问题是:这是真的吗?如果是这样,这在哪里指定
%%EOF
将在最后 1024 个字节中?
最佳答案
源代码确实这么说,在libqpdf/QPDF.cc
,但 ISO 32000-1:2008(PDF 1.7 版本)对文件预告片有以下说明:
7.5.5. File Trailer
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.
所以,如果你遵循标准,它比你说的更严格。
回到 Adobe 1.3 规范,在附录 H(实现说明)中,您将找到有关 Acrobat 查看器(不是文件格式)属性的这个小片段:
3.4.4, “File Trailer”
Acrobat viewers require only that the %%EOF marker appear somewhere within the last 1024 bytes of the file.
换句话说,它是说查看器(Adobe 的实现)在接受什么方面更加放松。然而,规范本身仍然认为
%%EOF
必须靠自己,在最后一行。该注释仍然存在于 Adobe 版本的文件格式文档中,最高版本为 1.7。但是,它已从 ISO 版本中删除,因为 ISO 一点也不关心产品的特定实现,只要它们符合书面标准。
Adobe 的文档可以在 here 中找到,他们还有权分发 ISO 32000 标准的(稍微修改的)版本 here .
关于pdf - PDF 中的 %%EOF 是否必须出现在文件的最后 1024 个字节内?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11896858/