0 Replies Latest reply on Sep 23, 2011 12:10 PM by SuperMacGuy

    How to add XMP Metadata to Indd documents

    SuperMacGuy Level 2

      How to add XMP metadata to a document:

       

      You can add standard metadata to the doc using the Metadata Preferences and by setting the list of standard properties with strings. Some of this info is from other posts, some from Adobe, and some from the very helpful IndiSnip blog (http://indisnip.wordpress.com). I'm putting this here so anyone can more easily get what they need in one place, it took me a long time to find it. I use Applescript but the same concepts apply to javascript/vb.

       

      You can add simple MD items using the standard Indd properties:

       

           tell metadata preferences of myDocument

                          set author to "Adobe"

                          set copyright info URL to "http://www.adobe.com"

                          set copyright notice to "This document is copyrighted."

                          set copyright status to yes

                          set description to "Example of xmp metadata scripting in InDesign CS"

                          set document title to "XMP Example"

                          set job name to "XMP_Example_2004"

                          set keywords to {"animal", "mineral", "vegetable"}


       

      If you want to add anything other than this you have to tell a namespace to add a property, or to add a container item in order to add an array.

       

      To use Adobe's built in namespace for XMP, I first declare it as a variable, although you could hard code it.  You can look in the metadata panel to see the various namespaces.

       

           set ns to "http://ns.adobe.com/xap/1.0/"

       

      Now we can make a single property in the XMP like this:

       

      set property namespace ns path "Sample_Property" value "my sample property text"

       

      FYI: The PATH must not include spaces.

       

      If you want to create an array for multiple items, first you make a container item, and then you can add objects into the container.

       

      set myNewContainer to create container item namespace ns path "email"

        --now populate the array with some items

                          set property namespace ns path "email/*[1]" value "someone@adobe.com"

                          set property namespace ns path "email/*[2]" value "chris@email.com"

       

      FYI: The objects are created using notation /*[1];  javascripters will understand this as array items moreso than Applescripters. Just use this to set items in a container.

       

      The tough part is how to add your own name space to XMP, so  you can really segregate your MD items from the other groups. Thanks to IndiSnip for this one (http://indisnip.wordpress.com/2010/09/07/storing-custom-data-into-indesign-file-xmp/)!

       

      I'm going to paraphrase some steps.

      In order to add a new namespace you must APPEND to the XMP data, with an XML file that contains a declaration of the new namespace, and at least 1 property. Save this file to a text file on your hard drive somewhere:

       

      <x:xmpmeta xmlns:x="adobe:ns:meta/">

      <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">

        <rdf:Description xmlns:IndiSnipXMP="http://indisnip.wordpress.com/">

         <IndiSnipXMP:creator>IndiSnip</IndiSnipXMP:creator>

         <IndiSnipXMP:website>http://indisnip.wordpress.com/</IndiSnipXMP:website>

         <IndiSnipXMP:e-mail>indisnip@gmail.com</IndiSnipXMP:e-mail>

        </rdf:Description>

      </rdf:RDF>

      </x:xmpmeta>

       

      You can see wherever there is "indisnip" you can replace that with your own name space or descriptor. You could change the property namespace from IndiSnipXMP to MyOwnNameXMP. In your script, you will call this like any other file/alias.

       

      append from alias "Macintosh HD:Users:chris:Desktop:NewNameSpace.xml"

       

      Now you can use the same methods as described above to add more MD items into your new namespace, you only have to specify your new namespace instead of "ns.adobe.com/xap/1.0"

       

      Chris

      http://chris.paveglio.com