Roger Misteli
2005-08-12 11:07:09 UTC
Hiyas
In a previous life, I added my XMP metadata using this:
byte[] xmpBuffer = getXMLDocumentAsByteArray();
PdfStream xmp = new PdfStream(xmpBuffer);
xmp.put(PdfName.TYPE, PdfName.METADATA);
xmp.put(PdfName.SUBTYPE, new PdfName("XML"));
PdfIndirectReference ref = writer.addToBody(xmp).getIndirectReference();
writer.getExtraCatalog().put(PdfName.METADATA, ref);
which works very nicely.
Now I have a PDF document that contains PDF Form fields which I want to
fill and flatten and that file contains XMP metadata. I want to remove
that metadata and write my own metadata (using the code above) OR, as
alternative (as better alternative actually), I want to merge the two
XML XMP streams (the old one that already exists plus my new one).
Does anyone know how I can do that?
Best regards and thanks
Rog
In a previous life, I added my XMP metadata using this:
byte[] xmpBuffer = getXMLDocumentAsByteArray();
PdfStream xmp = new PdfStream(xmpBuffer);
xmp.put(PdfName.TYPE, PdfName.METADATA);
xmp.put(PdfName.SUBTYPE, new PdfName("XML"));
PdfIndirectReference ref = writer.addToBody(xmp).getIndirectReference();
writer.getExtraCatalog().put(PdfName.METADATA, ref);
which works very nicely.
Now I have a PDF document that contains PDF Form fields which I want to
fill and flatten and that file contains XMP metadata. I want to remove
that metadata and write my own metadata (using the code above) OR, as
alternative (as better alternative actually), I want to merge the two
XML XMP streams (the old one that already exists plus my new one).
Does anyone know how I can do that?
Best regards and thanks
Rog