XMP Metadata

XMP Metadata

Forum member · Feb 23, 2007
Hello, I'd like to know how to insert custom XMP schemas into an existing PDF document, using XmpWriter for example. I've also tried the following code: MergeDocument document = new MergeDocument("C:\\MyDocument.pdf"); XmpMetadata data = document.getXmpMetadata(); but data is always null, although my document contains XMP metadata. Why? Thanks by advance for your response.

Re: XMP Metadata

Support · Feb 23, 2007
Any XMP metadata can be added to any document (whether the document is being merged in or created from scratch). This can be done by creating your schemas, adding your schemas to an XMPMetadata object and then setting that XMPMetadata to the XMPMetadata of the document you want it to be added to. Keep in mind that if this is a MergeDocument where the original PDF already contained XMP metadata that will be replaced with what has now been set on the doucment. For an example on adding a new XMPMetadata to a Document take a look at the XMP Metadata topic in the User Manual, http://www.DynamicPDF.com/Support/Java_Help_Documentation_10_06/user-manual/XMP%20MetaData.html . The reason you are seeing a null value for this "getXmpMetaData" is because this refers to any XMP metadata that has been defined on the document not any XMP metadata that is being merged in. If an XMPMetaData has been defined on that document (as described above) then the get would return that XMPMetadata. Thanks, ceTe Software Support Team

Re: XMP Metadata

Forum member · Feb 23, 2007
Thanks for your reply. Can you please post a sample of code for creating a custom XMP schema? Thanks. Laurent

Re: XMP Metadata

Forum member · Feb 26, 2007
Hi, I'm sorry to insist but the example only manipulates pre-defined XMP schemas (DublinCoreSchema, BasicSchema, RightsManagementSchema, BasicJobTicketSchema, PagedTextSchema) and I would like to use a new XMP schema but I don't know how to create it. Concerning my other question, how can I get XMP metadata from an existing document? Should I use another class than MergeDocument?

Re: XMP Metadata

Support · Feb 26, 2007
Hello Laurent, Can you please send an email referencing this forum post to our [^a|mailto:support@cete.com|Support Team^] so that they can send you a sample code which demonstrates creating custom schema. XMP values that are exposed through the Document’s properties (Author, Keywords, Subject, etc.) can be read or modified from an existing PDF using the MergeDocument class. All the XMP data from the existing merged PDF will be preserved but if it is not one of those specific properties off the document is can not be read or changed. You can add new XmpMetaData by removing the old one from the existing PDF without any problem. You can use MergeOptions class to remove the XmpMetaData while merging. Thanks, ceTe Software Support Team.