Jochen Stärk created PDFBOX-6088:
------------------------------------
Summary: Exception "No type defined for
{http://www.aiim.org/pdfa/ns/id/}rev" when trying to determine version of
PDF/A-4 document
Key: PDFBOX-6088
URL: https://issues.apache.org/jira/browse/PDFBOX-6088
Project: PDFBox
Issue Type: Bug
Components: XmpBox
Affects Versions: 3.0.5 PDFBox
Reporter: Jochen Stärk
Attachments: blanko_PDFA4.pdf
the following source code
{{String a4 =
"C:\\Users\\jstaerk\\workspace\\mustangproject\\library\\src\\test\\resources\\blanko_PDFA4.pdf";}}
{{String a1 =
"C:\\Users\\jstaerk\\workspace\\mustangproject\\library\\src\\test\\resources\\MustangGnuaccountingBeispielRE-20170509_505blanko.pdf";}}
{{try {}}
{{PDDocument document = Loader.loadPDF(new File(a4));}}
{{PDDocumentCatalog catalog = document.getDocumentCatalog();}}
{{PDMetadata metadata = catalog.getMetadata();}}
{{// the PDF version we could get through the document but we want the PDF-A
version,}}
{{// which is different (and can probably base on different PDF versions)}}
{{if (metadata != null) {}}
{{DomXmpParser xmpParser = new DomXmpParser();}}
{{XMPMetadata xmp = xmpParser.parse(metadata.createInputStream());}}
{{PDFAIdentificationSchema pdfaSchema = xmp.getPDFAIdentificationSchema();}}
{{if (pdfaSchema != null) {}}
{{System.out.println("PDF/A version " + pdfaSchema.getPart());}}
{{}}}
{{}}}
{{document.close();}}
{{} catch (XmpParsingException e) {}}
{{e.printStackTrace();}}
{{} catch (IOException e) {}}
{{e.printStackTrace();}}
{{}}}
correctly writes "PDF/A version 1" when tested e.g. with [this
file|https://www.mustangproject.org/files/MustangGnuaccountingBeispielRE-20190610_507blanko.pdf]
but when tested with attached (libre office generated, verapdf validated)
PDF/A-4 (on PDF 2 basis) it throws
{{{}org.apache.xmpbox.xml.XmpParsingException: No type defined for
\{http://www.aiim.org/pdfa/ns/id/}rev{}}}{{{}at
org.apache.xmpbox.xml.DomXmpParser.createProperty(DomXmpParser.java:341){}}}{{{}at
org.apache.xmpbox.xml.DomXmpParser.parseChildrenAsProperties(DomXmpParser.java:322){}}}{{{}at
org.apache.xmpbox.xml.DomXmpParser.parseDescriptionRoot(DomXmpParser.java:250){}}}{{{}at
org.apache.xmpbox.xml.DomXmpParser.parse(DomXmpParser.java:201){}}}{{{}at
de.usegroup.Main.main(Main.java:30){}}}{{{}{}}}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]