3 Replies Latest reply on Feb 13, 2017 3:41 AM by printastic_dev

    Add metadata to individual page items?


      We are using InDesign as part of a publishing workflow for a mobile publishing app. Each page element (e.g. Page, Image, Textbox) needs to be tagged with a unique identifier (a UUID), which we then export along with the document structure into a JSON file. We need to make sure that the UUID for each element, once set, doesn't change when the document is re-exported.


      Currently we have to save the identifiers in a separate file, and then merge them into our JSON as a second step. This is an unwieldy and error-prone approach. Is there any way that metadata for individual pages / page items can be saved directly into an InDesign document (and subsequently queried) through javascript? Any suggestions would be greatly welcome!

        • 1. Re: Add metadata to individual page items?
          Trevorׅ Adobe Community Professional

          Is not that what the id property about?

          In what form are you exporting the pages?

          • 2. Re: Add metadata to individual page items?
            Laubender Adobe Community Professional & MVP

            Hi Trevor,

            I'm not sure, but I guess the workflow of the OP is Export to EPUB or HTML.


            And unfortunately the ids that are created during the export process have nothing in common with the ids for page items we see in an InDesign document.


            One example showing exported IDs for e.g. Publish Online HTML:


            German InDesign:

            <div id = "_idContainer000" class="Einfacher-Textrahmen"


            English InDesign:

            <div id = "_idContainer000" class="Basic-Text-Frame"


            And is not following InDesign's pageItem id numbering and object naming system.

            ( Perhaps an added underscore is useful for some JavaScript operations on strings?! so I left the underscore notation alone )

            Made up scheme:


            <div id = "_356" class="TextFrame"


            For some objects that hold transparency even new objects are created that never existed in the InDesign document.
            It's hard to foresee what survives how when exported and if e.g. tagging with e.g. alt text would go unaltered through the workflow.



            • 3. Re: Add metadata to individual page items?
              printastic_dev Level 1

              I think I've figured this out now - the "label" property does what we need. I can set a metadata value programmatically by selecting an item (e.g. text frame)


              app.selection[0].label = 'some label';


              And we can confirm the value in the InDesign GUI by selecting the labeled object and clicking on Window > Utilities > Script Label.


              If we use comma separated values, we can store multiple items of metadata here.