简体   繁体   中英

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

I only find example about creating documents with PDF/A conformance but no example about just validating an existing document.

Is there a way to check conformance with iText 7 for an existing document?

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:

@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.

I answered: I confirm. iText isn't a PDF validator.

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 . There are no plans at iText to develop another validator to compete with the one funded by the EU.

See verapdf.org for more info.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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