Hello,
We use PDFBox to read the XMP metadata of PDF documents in the Factur-X
standard, a Franco-German e-invoicing standard.
It usually works very well, but we are experiencing an issue with some PDF
files sent by one of our partners.
In the XMP schema of these specific files, one of the property types doesn't
respect the expected case : we got "closed choice of Text" instead of "closed
Choice of Text".
<rdf:li rdf:parseType="Resource">
<pdfaProperty:name>ConformanceLevel</pdfaProperty:name>
<pdfaProperty:valueType>closed choice of
Text</pdfaProperty:valueType>
<pdfaProperty:category>external</pdfaProperty:category>
<pdfaProperty:description>The XML invoice data profile in
accordance with ZUGFeRD requirements
(permitted values MINIMUM, BASIC WL, BASIC, EN 16931,
EXTENDED)</pdfaProperty:description>
</rdf:li>
In the
pdfAExtensionHelper.java<https://github.com/apache/pdfbox/blob/trunk/xmpbox/src/main/java/org/apache/xmpbox/xml/PdfaExtensionHelper.java>,
the allowed values (CLOSED_CHOICE, CLOSED_CHOICE_U, OPEN_CHOICE and
OPEN_CHOICE_U) are case-sensitive, even if there was a
fix<https://issues.apache.org/jira/browse/PDFBOX-6131> (PDFBOX-6131) to allow
the first letter to be upper or lowercase.
So when we try to parse the XMP Metadata with xmpbox (3.0.7, but must be the
same with the last version), we get this exception :
Caused by: org.apache.xmpbox.xml.XmpParsingException: Unknown property value
type : closed choice of Text
at
org.apache.xmpbox.xml.PdfaExtensionHelper.populatePDFAPropertyType(PdfaExtensionHelper.java:206)
at
org.apache.xmpbox.xml.PdfaExtensionHelper.populatePDFASchemaType(PdfaExtensionHelper.java:186)
at
org.apache.xmpbox.xml.PdfaExtensionHelper.populateSchemaMapping(PdfaExtensionHelper.java:140)
at org.apache.xmpbox.xml.DomXmpParser.parse(DomXmpParser.java:230)
at org.apache.xmpbox.xml.DomXmpParser.parse(DomXmpParser.java:126)
I've searched in the XMP Specification, but there's nothing clear about if the
syntax must strictly respects the specified case.
The PDFLib validator accepts the file, and it was issued by a great national
company (I admit it's not a strong argument).
So I think that the full "closed choice" or "open choice" types should be
parsed case-insensitively.
Unfortunately, I can't share the test file because it contains sensitive
informations, but if you really need one I can try to mock it up.
Sylvère Babin
Programmeur fondations
Cegid XRP Ultimate
+33 (0)4 71 64 60 26
[Facebook]<https://www.facebook.com/CegidGroup/> [Twitter]
<https://twitter.com/cegid_ww> [LinkedIn]
<https://fr.linkedin.com/company/cegid>
cegid.com<https://www.cegid.com/>
[Cegid]<http://www.cegid.com/>
Cegid est susceptible d'effectuer un traitement sur vos données personnelles à
des fins de gestion de notre relation commerciale. Pour plus d'information,
consultez https://www.cegid.com/fr/privacy-policy
Ce message et les pièces jointes sont confidentiels et établis à l'attention
exclusive de ses destinataires. Toute utilisation ou diffusion, même partielle,
non autorisée est interdite. Tout message électronique est susceptible
d'altération; Cegid décline donc toute responsabilité au titre de ce message.
Si vous n'êtes pas le destinataire de ce message, merci de le détruire et
d'avertir l'expéditeur.
Cegid may process your personal data for the purpose of our business
relationship management. For more information, please visit our website
https://www.cegid.com/en/privacy-policy
This message and any attachments are confidential and intended solely for the
addressees. Any unauthorized use or disclosure, either whole or partial is
prohibited. E-mails are susceptible to alteration; Cegid shall therefore not be
liable for the content of this message. If you are not the intended recipient
of this message, please delete it and notify the sender.