Dear all,

With Dominik¹s help I have managed to add/replace XMP in a PDF using the
following code

       // newXMP is a char * pointing to the new XMP, newXMPLen it is the
length of the XMP

        PdfObject *xmpObj =
podofoDoc->GetObjects().CreateObject("Metadata");
        xmpObj->GetDictionary().AddKey(PdfName("Subtype"), PdfName("XML"));
        xmpObj->GetStream()->Set(newXMP, newXMPLen, TVecFilters());     //
no filters are provided so that the XMP is output unencoded ­ this is what
the Adobe apps do
        podofoDoc->GetCatalog()->GetDictionary().AddKey(PdfName("Metadata"),
xmpObj->Reference());
        podofoDoc->Write(³aFile.pdf²);

I found that this leaves the original XMP in the PDF and adds the new XMP at
the end. This isn¹t a problem based upon the spec, the XMP found is used
however the Adobe XMP library handles PDFs very crudely and returns the
first XMP it finds.

Is there any way to get PoDoFo to only write out the new XMP? Also is it
possible to get the new XMP written near the start of the file rather than
at the end?

Thanks in advance,
Ian
------------------------------------------------------------------------------
This SF.net email is sponsored by 

Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev 
_______________________________________________
Podofo-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/podofo-users

Reply via email to