使用pdfbox的pdf版本信息不正确 [英] Pdf version information not correct using pdfbox

查看:123
本文介绍了使用pdfbox的pdf版本信息不正确的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个pdf文件,该文件在Acrobat Reader中打开时显示的版本为1.5,但是在使用Pdfbox(版本1.8.3)时的版本为1.3.

We are having a pdf which when opened in Acrobat Reader shows a version of 1.5 but when using Pdfbox(version 1.8.3) the version shows 1.3.

我们正在使用的代码:

`aDocument.getDocument().getVersion()`

其中aDocument是PDDocument的实例. 我们使用的Pdfbox版本是1.8.3

where aDocument is an instance of PDDocument. Pdfbox version we are using is 1.8.3

任何对此的帮助将不胜感激.

Any help regarding this will be highly appreciated.

推荐答案

Hitesh Saliya 已经讨论过PDF他的问题 Adob​​e显示了不正确的PDF版本(PDF)在属性"中 .在此答案中,这样的出现

Hitesh Saliya already discussed that PDF in his question Adobe showing incorrect PDF Version (of PDF) in Properties. In this answer it became appearant that

    如果仅考虑版本标头(文档中没有要考虑的 Version 目录条目),
  • 1.3版本是正确的;
  • 如果至少还考虑到使用了对象流,交叉引用流,图层和透明度,则
  • 至少 1.5版是正确的.
  • version 1.3 was correct if one only takes the version header into account (there are no Version catalog entries in the document to consider);
  • at least version 1.5 was correct if one also took into account that object streams, cross reference streams, layers, and transparency are used.

因此,在某种程度上,PDFBox和Adobe Reader都是正确的.

In a way, therefore, both PDFBox and Adobe Reader are correct.

因此,首先必须确定认为PDF文档的版本是什么.

Thus, one first has to decide what one considers the version of a PDF document to be.

  • 声称是PDF文件的版本吗?

作为特殊情况,主张不同版本的PDF怎么办?例如.标头和目录中的不同条目,或不同增量更新中的不同条目.

As a special case, what about PDFs claiming different versions? E.g. different entries in header and catalog, or different entries in different incremental updates.

该版本是否为所选的指标程序(例如Adobe Reader的固定版本)可识别用于PDF?

Is it the version a chosen indicator program (e.g. Adobe Reader in a fixed version) recognizes for the PDF?

最小/最大版本根据相应的PDF参考/规范是否有效?

该范围内的任何版本都可能是正确答案(不是文档的版本,而是版本)?

Could even any version in that range be a correct answer (resulting not in the version but the versions of a document)?

上述的某些混合物,例如所声明的版本的最高版本以及该PDF有效的最低版本?

Some mixture of the above, e.g. the maximum of the version claimed and the lowest version according to which the PDF is valid?

尽管如此,人们很难期望在通用PDF库中实现除选项1之外的任何其他功能.

Seriously, though, one can hardly expect anything more than option 1 to be implemented in a general purpose PDF library.

这篇关于使用pdfbox的pdf版本信息不正确的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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