pdf - PDF 中的 %%EOF 是否必须出现在文件的最后 1024 个字节内?

标签 pdf

根据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.


所以,如果你遵循标准,它比你说的更严格。

回到 Adob​​e 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必须靠自己,在最后一行。
该注释仍然存在于 Adob​​e 版本的文件格式文档中,最高版本为 1.7。但是,它已从 ISO 版本中删除,因为 ISO 一点也不关心产品的特定实现,只要它们符合书面标准。
Adobe 的文档可以在 here 中找到,他们还有权分发 ISO 32000 标准的(稍微修改的)版本 here .

关于pdf - PDF 中的 %%EOF 是否必须出现在文件的最后 1024 个字节内?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11896858/

相关文章:

java - xfa.fillXfaForm 之后透明图像显示为黑框。 xfa 填充是否支持透明图像?

php - 在 php 的 postgresql bytea 列中插入 pdf/images

pdf - 如何创建 PDF-out-of-Sphinx 文档工具

ios - 编码 iOS PDF 阅读器

c# - 使用 docraptor c# 在 PDF 中添加页眉和页脚图像

pdf - IPython/Jupyter 将笔记本保存为 PDF 时出现问题

pdf - PDF 是用什么来衡量的?

C# PdfSharp - 从 HTML 生成 PDF 的困难

javascript - pdfmake 从长 HTML 表生成 PDF

pdf - 以编程方式从 Excel 数据填写 PDF 表单