I have to add some XMP data to a PDF/A-3 file.
This is the XMP data I want to add:
<pdfaExtension:schemas>
<rdf:Bag>
<rdf:li rdf:parseType="Resource">
<pdfaSchema:schema>Factur-X PDFA Extension Schema</pdfaSchema:schema>
<pdfaSchema:namespaceURI>urn:factur-x:pdfa:CrossIndustryDocument:invoice:1p0#</pdfaSchema:namespaceURI>
<pdfaSchema:prefix>fx</pdfaSchema:prefix>
<pdfaSchema:property>
<rdf:Seq>
<rdf:li rdf:parseType="Resource">
<pdfaProperty:name>DocumentFileName</pdfaProperty:name>
<pdfaProperty:valueType>Text</pdfaProperty:valueType>
<pdfaProperty:category>external</pdfaProperty:category>
<pdfaProperty:description>name of the embedded XML invoice file</pdfaProperty:description>
</rdf:li>
<rdf:li rdf:parseType="Resource">
<pdfaProperty:name>DocumentType</pdfaProperty:name>
<pdfaProperty:valueType>Text</pdfaProperty:valueType>
<pdfaProperty:category>external</pdfaProperty:category>
<pdfaProperty:description>INVOICE</pdfaProperty:description>
</rdf:li>
<rdf:li rdf:parseType="Resource">
<pdfaProperty:name>Version</pdfaProperty:name>
<pdfaProperty:valueType>Text</pdfaProperty:valueType>
<pdfaProperty:category>external</pdfaProperty:category>
<pdfaProperty:description>The actual version of the ZUGFeRD XML schema</pdfaProperty:description>
</rdf:li>
<rdf:li rdf:parseType="Resource">
<pdfaProperty:name>ConformanceLevel</pdfaProperty:name>
<pdfaProperty:valueType>Text</pdfaProperty:valueType>
<pdfaProperty:category>external</pdfaProperty:category>
<pdfaProperty:description>The selected ZUGFeRD profile completeness</pdfaProperty:description>
</rdf:li>
</rdf:Seq>
</pdfaSchema:property>
</rdf:li>
</rdf:Bag>
</pdfaExtension:schemas>
It is an array that contains a structure that in turn contains another array of structures
I tried the following:
- create the XMP Meta data
XMPMeta xmpMeta = XMPMetaFactory.create();
- add an array
xmpMeta.appendArrayItem(XMPConst.NS_PDFA_EXTENSION, "schemas", new PropertyOptions(PropertyOptions.ARRAY), "schema", null);
- add the metadata to my PDF document
pdfDocument.setXmpMetadata(xmpMeta);
By doing this i get the following result:
<pdfaExtension:schemas>
<rdf:Bag>
<rdf:li>schema</rdf:li>
</rdf:Bag>
</pdfaExtension:schemas>
How can i add the scructure node to this array?
I tried to compose the array item path and add the structure to it:
String path = XMPPathFactory.composeArrayItemPath("schemas", 1);
xmpMeta.setStructField(XMPConst.NS_PDFA_EXTENSION, path, XMPConst.NS_PDFA_SCHEMA, "namespaceURI", "Factur-X PDFA Extension Schema", new PropertyOptions(PropertyOptions.STRUCT));
but i get the XMPException “Structs and arrays can’t have values”
Unfortunately I could not find much information about iText and XMP.