简体   繁体   English

如何使用iText 7检查现有文档的PDF / A一致性?

[英]How to check PDF/A conformance of existing document with iText 7?

I'm trying to check the conformance (PDF/A-1B) of an existing PDF document with iText. 我正在尝试使用iText检查现有PDF文档的符合性(PDF / A-1B)。 Unfortunately it only checks the conformance for newly created elements in document but ignores existing parts of document. 不幸的是,它仅检查文档中新创建的元素的符合性,而忽略文档的现有部分。

byte[] pdf = ...; // pdf document which claims to be conform but is not conform (1 font is not embedded)
final PdfADocument pdfADocument = new PdfADocument(new PdfReader(new ByteArrayInputStream(pdf)), 
     new PdfWriter(new ByteArrayOutputStream()));

pdfADocument.close();

If I add something not conform to pdfADocument then the call to close() throws a PdfAConformanceException . 如果我添加了不符合pdfADocument则对close()的调用将引发PdfAConformanceException

I only find example about creating documents with PDF/A conformance but no example about just validating an existing document. 我仅找到有关创建符合PDF / A规范的文档的示例,而没有有关仅验证现有文档的示例。

Is there a way to check conformance with iText 7 for an existing document? 有没有办法检查现有文档与iText 7的一致性?

Originally posted as a comment (because it felt too short to be a real answer), but now added as an answer as requested by the OP: 最初是作为评论发布的(因为它太短了,无法成为一个真正的答案),但现在根据OP的要求添加为答案:

@mkl wrote: AFAIK iText just tries to make sure it itself does not introduce any issues but it does not contain a PDF/A validator. @mkl写道: AFAIK iText只是试图确保它本身不会引起任何问题,但是它不包含PDF / A验证程序。

I answered: I confirm. 我回答: 我确认。 iText isn't a PDF validator. iText不是PDF验证器。

The EU is sponsoring the development of an open source PDF/A validator and iText is following up on its development through the PDF Association . 欧盟赞助了开放源PDF / A验证器的开发,而iText通过PDF协会跟踪其开发。 There are no plans at iText to develop another validator to compete with the one funded by the EU. iText没有计划开发另一种验证器来与欧盟资助的验证器竞争。

See verapdf.org for more info. 有关更多信息,请参见verapdf.org

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM