DavideNoaro - 2006-08-24

Hi,
I'm using JempBox to work with XMP, but I can't find a simple way to save XMPMetadata back to PDF file. The problem is that I have a DOM representation of XMPMetadata but to save back in PDF file I need to work with InputStream....

Is it right or there is a way to save directly a DOM representation of XMPMetadata in PDF file?

I wrote:
-----------------------------------------------
XMPMetadata metadata = new XMPMetadata();

XMPSchemaDublinCore dc = metadata.addDublinCoreSchema();
dc.addCreator("Davide Noaro");
dc.addTitle("How to use JempBox");

//Get the Dom representation of XMP
Document dom = metadata.getXMPDocument();

//Load the PDF document where to store XMP
PDDocument doc = PDDocument.load( new File("C:\\Temp\\example.pdf"));
PDDocumentCatalog catalog = doc.getDocumentCatalog();
PDMetadata meta = catalog.getMetadata();
           
          
InputStream newXMPData = ????????;
PDMetadata newMetadata = new PDMetadata(doc, newXMPData, false );
catalog.setMetadata( newMetadata );
           
doc.save("C:\\Temp\\example.pdf");
doc.close();
-------------------------------------------------

Thanks in advance for any suggestions,
Davide Noaro.