I need to create in java (using itext) the following xmp metadata and to put it in one of my pdf.
<rdf:Description rdf:about="" xmlns:pdfaExtension="http://www.aiim.org/pdfa/ns/extension/" xmlns:pdfaSchema="http://www.aiim.org/pdfa/ns/schema#" xmlns:pdfaProperty="http://www.aiim.org/pdfa/ns/property#" xmlns:pdfaType="http://www.aiim.org/pdfa/ns/type#" xmlns:pdfaField="http://www.aiim.org/pdfa/ns/field#"> <pdfaExtension:schemas>
<rdf:Bag>
<rdf:li rdf:parseType="Resource">
<pdfaSchema:schema>ABI Assegni Schema</pdfaSchema:schema> <pdfaSchema:namespaceURI>http://abi.it/std/cheque/xmlns</pdfaSchema:namespaceURI> <pdfaSchema:prefix>assegni</pdfaSchema:prefix>
<pdfaSchema:property>
<rdf:Seq>
<rdf:li rdf:parseType="Resource">
<pdfaProperty:name>IDDocumento</pdfaProperty:name> <pdfaProperty:valueType>Text</pdfaProperty:valueType> <pdfaProperty:category>external</pdfaProperty:category> <pdfaProperty:description>Identificativo univoco del documento</pdfaProperty:description>
</rdf:li>
<rdf:li rdf:parseType="Resource">
<pdfaProperty:name>datachiusura</pdfaProperty:name> <pdfaProperty:valueType>Date</pdfaProperty:valueType> <pdfaProperty:category>external</pdfaProperty:category> <pdfaProperty:description>Data e ora della produzione del file</pdfaProperty:description>
</rdf:li>
<rdf:li rdf:parseType="Resource">
<pdfaProperty:name>oggettodocumento</pdfaProperty:name> <pdfaProperty:valueType>Text</pdfaProperty:valueType> <pdfaProperty:category>external</pdfaProperty:category> <pdfaProperty:description>Oggetto del documento</pdfaProperty:description>
</rdf:li>
<rdf:li rdf:parseType="Resource">
<pdfaProperty:name>soggettoproduttore</pdfaProperty:name> <pdfaProperty:valueType>soggetto</pdfaProperty:valueType> <pdfaProperty:category>external</pdfaProperty:category> <pdfaProperty:description>Soggetto produttore</pdfaProperty:description>
</rdf:li>
<rdf:li rdf:parseType="Resource">
<pdfaProperty:name>destinatario</pdfaProperty:name> <pdfaProperty:valueType>soggetto</pdfaProperty:valueType> <pdfaProperty:category>external</pdfaProperty:category> <pdfaProperty:description>Destinatario</pdfaProperty:description>
</rdf:li> </rdf:Seq>
</pdfaSchema:property>
</rdf:li>
</rdf:Bag>
</pdfaExtension:schemas>
</rdf:Description>
Until now I tried this portion of code:
PdfReader reader = new PdfReader(baos.toByteArray());
PdfAStamper stamper = new PdfAStamper(reader, baos, PdfAConformanceLevel.PDF_A_1B);
String namespaceExtension = new String("http://www.aiim.org/pdfa/ns/extension/");
String namespaceSchema = new String("http://www.aiim.org/pdfa/ns/schema#");
String namespaceProperty = new String("http://www.aiim.org/pdfa/ns/property#");
String namespaceType = new String("http://www.aiim.org/pdfa/ns/type#");
String namespaceField = new String("http://www.aiim.org/pdfa/ns/field#");
XMPSchemaRegistry registry = XMPMetaFactory.getSchemaRegistry();
registry.registerNamespace(namespaceExtension, "pdfaExtension");
registry.registerNamespace(namespaceSchema, "pdfaSchema");
registry.registerNamespace(namespaceProperty, "pdfaProperty");
registry.registerNamespace(namespaceType, "pdfaType");
registry.registerNamespace(namespaceField, "pdfaField");
XmpWriter w = new XmpWriter(baos);
w.appendArrayItem(namespaceExtension, "schemas", "a");
w.close();
writer.setXmpMetadata(baos.toByteArray());
And the created xmp is the following:
<pdfaExtension:schemas>
<rdf:Bag>
<rdf:li>a</rdf:li>
</rdf:Bag>
Now I can't understand on how to go on. Any idea on how to do this?
Thanks in advance