How to read XMP metadata of an indd file using Actionscript

Hi All,
I am trying to read XMP metadata of an indd file using CS Extension Builder in Flash Builder 4.5.
The documentation has many class like XMPmeta, XMPStruct, etc.
I have got the currently opened document in InDesign as follows:
var myDoc:Document = InDesign.app.activeDocument();
And a new XMPmeta object is created as follows:
var myXMP:XMPMeta = new XMPMeta();
How to initialize document's xmp metadata in the XMPMeta object? Or is there any other way to get the XMP metadata of currently opened document in InDesign?

I have found that the XMP data of an InDesign document can be retrieved in actionscript as follows:
InDesign.app.activeDocument.metadataPreferences
This returns the MetadataPreference object.
But I am not able to iterate each namespace in the xmp. There isn't any XMPFile class which allows me to serialize the object to xml file so that I can iterate all elements in the XMP.
I could not relate class like XMPMeta, XMPProp, etc. with the MetaDataPreference class. So, how to obtain the entire xmp packet from the MetadataPreference object?
Can anyone shed light on this?

Similar Messages

  • Adding/Reading XMP Metadata in a psd file

    Hi,
    I'm having some troubles to understand how to add and read XMP metadata on a psd file. I followed the Panel developer guide tutorial, and try to look on the internet for some answers, but I'm still stuck ...
    Here is the simple example I'm trying to make (using part of the code from the panel developer guide) :
         The function loads the XMP Script Library.
         @returns True if the XMP Script Library was loaded successfully.
         @type Boolean
    function loadXMPLibrary(){
         if ( !ExternalObject.AdobeXMPScript ){
              try{
                   ExternalObject.AdobeXMPScript = new ExternalObject('lib:AdobeXMPScript');
              }catch (e){
                   alert("Can't load XMP Script Library");
                   return false;
         return true;
         The function unloads the XMP Script Library.
    function unloadXMPLibrary(){
         if( ExternalObject.AdobeXMPScript ) {
              try{
                   ExternalObject.AdobeXMPScript.unload();
                   ExternalObject.AdobeXMPScript = undefined;
              }catch (e){
                   alert("Can't unload XMP Script Library");
        Try to put a new property into the metadata
    if( app.activeDocument || !loadXMPLibrary()){
        var xmp = new XMPMeta(activeDocument.xmpMetadata.rawData);
        xmp.setProperty( XMPConst.NS_EXIF, "myProperty", "test" );
        activeDocument.xmpMetadata.rawData = xmp.serialize();
        unloadXMPLibrary();
        Window.alert(activeDocument.xmpMetadata.rawData);
    I don't really know where I'm wrong, could you help me please ?
    Thanks,
    Julien

    Rather mess with EXIF and Dublin Core namespaces, wouldn't it be better to create your own?
    IE:
    #target photoshop
    addtoMeta();
    function addtoMeta(){
    if(!documents.length) return;
    if (ExternalObject.AdobeXMPScript == undefined) ExternalObject.AdobeXMPScript = new ExternalObject("lib:AdobeXMPScript");
    var xmp = new XMPMeta( activeDocument.xmpMetadata.rawData);
    var myNamespace = "http://my.fantastic.newspace/";
    var myPrefix = "nsfns:";
    XMPMeta.registerNamespace(myNamespace, myPrefix);
    xmp.setProperty(myNamespace, "myProperty", "A Test String");
    app.activeDocument.xmpMetadata.rawData = xmp.serialize();

  • How to read the content of ms-word file use pure java???

    how to read the content of ms-word file use pure java???

    hi,
    check this: http://jakarta.apache.org/poi/

  • How to read XMP metadata from a Jpeg

    This seems like it should be a no-brainer, but I can't find any classes to do this ?? I can find classes to read song titles from MP3 files, I want to do similar with jpeg image files.
    In photoshop and lightroom you can set up titles and captions (and copyright info) in the metadata. When you save a jpeg this gets embedded in the file.
    How to read this info and parse it and use it once you have loaded it into a BitMapData???
    I am Flash/AS3.0 code only no IDE -  please no flex/AIR examples!
    Thanks!

    http://www.adobe.com/devnet/xmp/

  • How to read a table from a word file, using HWPF

    How can I read a table from a Word file using HWPF?
    I looked in API and Table class doesn't seem to have a constructor... very very strange for me. pls help

    the constructor is HWPFDocument = new HWPFDocument(/*file*/)
    Here is the API for that
    http://poi.apache.org/apidocs/org/apache/poi/hwpf/HWPFDocument.html
    Also here is another link to something that might help you more with tables
    http://www.aspose.com/Community/forums/thread/79182.aspx

  • How to get/set value in illustrator preference file using ActionScript 3.0

    Hi all,
    I want to get/set the flex panel components preference in illustrator preference file using ActionScript 3.0.
    I tried to achieve this  like --
    import com.adobe.illustrator.Preferences;
    var pref : Prefereneces = new Preferences();
    //To set value I used  this...
    pref.setStringPreference("url", id1.text);
    //To get value I used this..
    id1.text = pref.getStringPreference("url");
    i think there is prb in creating  Preference variable but I am unable to resolve.
    plz help.
    Thanks.

    I am having trouble with setStringPreference. It seems to be setting the value to 0 in the Prefs file. When I first wrote the code, it was working, but something is keeping it from saving the right value now. Did you get yours working? Any ideas?

  • How can I embed metadata in a pdf file using Acrobat XI Pro?

    Hi, everyone!
    I need some info how I can put things like key words, description of the file and the like permanently in the file to let it 'travel' in the file everywhere, no matter what the OS is. I guess I should use Properties 'path' but it resembles Windows system properties, so I'm not sure. Moreover, there's so little about it in manuals....
    Once I've done with it, can it be read just by Adobe Reader?
    And one important thing more: is there any inner search engine inside Acrobat XI to search the files by key words and other similar metadata criteria or I'm solely dependant on the OS search function?

    Thanks for the link - it sounds highly specialised, but simple experiments of opening a Properties Windows and putting some description notes and author or key word is readable by Acrobat reader or the system search engine so maybe it's not really complicated - mind you, I don't mean right-clicking on the file where options are poor and probably thode of the OS but Preferences edition after opening the document in Acrobat XI Pro - I hope this one is of Adobe and maybe I won't need Bridge to read it I know in the suggested thread it's a problem of graphics metadata within the pdf file....

  • How to read the attribute of the xml file using jaxb

    Thanks,
    Buddy as i have a issue i have to read the xml file using jaxb and xml file contains this data and i have read the attribute like name , desc and action for a particular menu name pls tell the code how to do this it will be a great favour to me
    thanx in advance
    Rasool
    <contextmenu>
    <menu name='Lead' >
    <menuitem name='newlead' desc='New Lead' action='/leads.do?dispatch=insert' />
    <menuitem name='editlead' desc='Edit Lead' action='' />
    <menuitem name='leadinfo' desc='Lead Information' action='' />
    </menu>
    <menu name='Cases' >
    <menuitem name='' desc='' action='' />
    <menuitem name='' desc='' action='' />
    <menuitem name='' desc='' action='' />
    </menu>
    <menu name='Contact' >
    <menuitem name='' desc='' action='' />
    <menuitem name='' desc='' action='' />
    <menuitem name='' desc='' action='' />
    </menu>
    </contextmenu>

    What my program do is to get the encoding of XML files and convert them to UTF-8 encoding files, while I need this "encoding" information of the original XML document thus I can convert...
    After reading specifications and JDOM docs, the truth turns to be disappointed, no function is provided to get this information in JDOM level 2(the current released one), while it's promissed that this function will be provided in JDOM level API....
    Thanx all for your help and attention!!!

  • How to read some lines from a text file using java.

    hi,
    i m new to java and i want to read some lines from a text file based on some string occurrence in the file. This file to be read in steps.
    we only want to read the file upto the first Occurrence of "TEXT" string.
    How to do it ,,,
    Kinldy give the code
    Regards,
    Sagar
    this is the text file
    dfgjdjj
    sfjhjkd
    ghjkdg
    hjkdgh TEXT
    ikeyt
    ujt
    jk
    tyk TEXT
    rukl
    r

    Hendawy wrote:
    Since the word "TEXT" is formed of 4 letters, you would read the text file 4 bytes by four bytes. Wrong on two counts. First, the file may not be encoded 1 byte per character. It could be utf-16 in which case it would be two byte per character. Second, even if it were 1 byte per character, the string "Text" may not start on a 4 byte boundary.
    Consider a FileInputStream object "fis" that points to your text file. use fis.read(byte[] array, int offset, int len) to read every four bytes. Convert the "TEXT" String into a byte array "TEXT".getBytes(), and yous the Arrays class to compare the equality of the read bytes with your "TEXT".getBytes()Wrong since it relies on my second point and will fail when fis.read(byte[] array, int offset, int len) does not read 4 bytes (as is no guaranteed to). Check the Javadoc. Also, the file may not be encoded with the default character encoding.
    The problem is easily solved by reading a line at a time using a BufferedReader wrapping an InputStreamReader wrapping a FileInputStream and specifying the correct character encoding.
    Edited by: sabre150 on Apr 29, 2009 2:13 PM

  • How to read specific lines from a text file using external table or any other method?

    Hi,
    I have a text file with delimited data, I have to pick only odd number rows and load into a table...
    Ex:
    row1:  1,2,2,3,3,34,4,4,4,5,5,5,,,5  ( have to load only this row)
    row2:   8,9,878,78,657,575,7,5,,,7,7
    Hope this is enough..
    I am using Oracle 11.2.0 version...
    Thanks

    There are various ways to do this.  I would be inclined to use SQL*Loader.  That way you can load it from the client or the server and you can use a SQL*Loader sequence to preserve the row order in the text file.  I would load the whole row as a varray into a staging table, then use the TABLE and MOD functions to load the individual numbers from only the odd rows.  Please see the demonstration below.
    SCOTT@orcl12c> HOST TYPE text_file.csv
    1,2,2,3,3,34,4,4,4,5,5,5,,,5
    8,9,878,78,657,575,7,5,,,7,7
    101,201
    102,202
    SCOTT@orcl12c> HOST TYPE test.ctl
    LOAD DATA
    INFILE text_file.csv
    INTO TABLE staging
    FIELDS TERMINATED BY ','
    TRAILING NULLCOLS
    (whole_row VARRAY TERMINATED BY '/n' (x INTEGER EXTERNAL),
    rn SEQUENCE)
    SCOTT@orcl12c> CREATE TABLE staging
      2    (rn         NUMBER,
      3     whole_row  SYS.OdciNumberList)
      4  /
    Table created.
    SCOTT@orcl12c> HOST SQLLDR scott/tiger CONTROL=test.ctl LOG=test.log
    SQL*Loader: Release 12.1.0.1.0 - Production on Tue Aug 27 13:48:37 2013
    Copyright (c) 1982, 2013, Oracle and/or its affiliates.  All rights reserved.
    Path used:      Conventional
    Commit point reached - logical record count 4
    Table STAGING:
      4 Rows successfully loaded.
    Check the log file:
      test.log
    for more information about the load.
    SCOTT@orcl12c> CREATE TABLE a_table
      2    (rn       NUMBER,
      3     data  NUMBER)
      4  /
    Table created.
    SCOTT@orcl12c> INSERT INTO a_table (rn, data)
      2  SELECT s.rn,
      3         t.COLUMN_VALUE data
      4  FROM   staging s,
      5         TABLE (s.whole_row) t
      6  WHERE  MOD (rn, 2) != 0
      7  /
    17 rows created.
    SCOTT@orcl12c> SELECT * FROM a_table
      2  /
            RN       DATA
             1          1
             1          2
             1          2
             1          3
             1          3
             1         34
             1          4
             1          4
             1          4
             1          5
             1          5
             1          5
             1
             1
             1          5
             3        101
             3        201
    17 rows selected.

  • [CS3 JS] How to force XMP metadata update for a thumbnail?

    Hi Folks,
    In a JavaScript in Bridge CS3, I'm updating a value in the XMP metadata for a Thumbnail. Later in the script I want to read the updated XMP metadata information from the Thumbnail, but often Bridge hasn't updated the metadata by the time I read it. In other words, my script reads the value prior to the update. I'm guessing there's a caching issue going on.
    I'm new to Bridge scripting, and I am hoping someone here can offer suggestions on how I can (or, even *if* I can) force Bridge to update the XMP metadata cache for a file so that when I read it later in the script it will reflect the recent changes. I've tried using Thumbnail.refresh(), but that doesn't seem to do the trick. I don't mind a slower script, I just want to be able to read the correct value.
    Thanks in advance for any help!
    -- Jim

    Hi David,
    I'm running this script on a MacBook Pro, 2.5GHz, 4GB RAM.
    Here is a sample JSX that shows the issue I'm having:
    #target "bridge-2.0"
    main();
    function main() {
        if( xmpLib == undefined ) {
            var pathToLib = Folder.startup.fsName + "/AdobeXMPScript.framework";
            var libfile = new File( pathToLib );
            var xmpLib = new ExternalObject("lib:" + pathToLib );
        var myValue = "Headline Test";
        var myFilePath = "~/Desktop/TestFile.tif";
        var curHeadlineStr = XMPGetHeadline(myFilePath);
        $.writeln("Headline value: \"" +  curHeadlineStr + "\"");
        XMPWriteHeadline(myFilePath, myValue);
        // *** I would like to refresh the cache here ***
        curHeadlineStr = XMPGetHeadline(myFilePath);
        $.writeln("Headline value: \"" +  curHeadlineStr + "\"");
    function XMPGetHeadline(theFilePath) {
        var thumb = new Thumbnail(File (theFilePath) );
        md = thumb.synchronousMetadata;   
        xmp = new XMPMeta(md.serialize());
        var myHeadlineXMPProp = xmp.getProperty
            (XMPConst.NS_PHOTOSHOP, "Headline", XMPConst.STRING);
        return myHeadlineXMPProp;
    function XMPWriteHeadline(theFilePath, theTextStr){
        var thumb = new Thumbnail(File (theFilePath) );
        md = thumb.synchronousMetadata;   
        xmp = new XMPMeta(md.serialize());
        var myOrigHeadlineXMPProp = xmp.getProperty
            (XMPConst.NS_PHOTOSHOP, "Headline", XMPConst.STRING);
        xmp.deleteProperty(XMPConst.NS_PHOTOSHOP, "Headline");
        xmp.setProperty(XMPConst.NS_PHOTOSHOP, "Headline", theTextStr, 0, XMPConst.STRING);
        var updatedPacket = xmp.serialize
            (XMPConst.SERIALIZE_OMIT_PACKET_WRAPPER | XMPConst.SERIALIZE_USE_COMPACT_FORMAT);
        thumb.metadata = new Metadata(updatedPacket);
    To run this script, in main(), set the myFilePath variable to the path of a file that has an "IPTC Code" "Headline" property.
    This script, when run, sets the "Headline" property value to the value of myValue. After runing the script for the first time, take a look at the console log. You should see that Headline value displayed does not change between the two console entries. My log looks like this after the first run:
      Headline value: "undefined"
      Headline value: "undefined"
    The thing is, the second entry in the console listing, above, was created after the Headline value was set by XMPWriteHeadline(). The two values should be different between the two console entries.
    If you run the script a second time against the same file, you will see that the Headline value does contain the value that was written in the first run of the script--it just took some time to update the cache, I'm guessing. Here's the second run's log:
      Headline value: "Headline Test"
       Headline value: "Headline Test"
    So, what I'm looking for is a way to insert code (where the comment line "//*** I would like to refresh the cache here ***" appears), to force Bridge CS3 to refresh its cache so that when I call XMPGetHeadline() after calling XMPWriteHeadline(), the Headline value will return the value that was just written.
    I hope this is clear enough...
    Thanks!!!!
    -- Jim

  • How to import XMP Metadata?

    Could you please explain me, how to import XMP metadata in pdf file through "Live Cycle ES"?

    > Please give any samples.
    As I said, the samples are in the API Reference. All you have to do is look them up.

  • How to import XMP metadata in pdf

    Could you please explain me, how to import XMP metadata in pdf file through "Live Cycle ES"?

    Yes, with LiveCycle ES (almost) all services can be invoked from any of the available endpoints (watch folder, EJB, WebService, etc).
    In this case since the ImportXMP requires two input files (the PDF and the XMP) you will need to drop a directory containing both of your files into the watch folder (not the individual files). This is because several requests can be dropped into the watch folder at the same time and without the sub directories LiveCycle couldn't tell what XMP when with what PDF.
    A com.adobe.idp.Document - AKA: Document - object is one of the common object types used across all LiveCycle products. When you deal with PDFs and many other binary file objects they are stored a Document object. It is more important that you know this when using Workbench, web services or the Java API.
    You should have a look at the documentation at: http://livedocs.adobe.com/livecycle/8.2/programLC/programmer/help/001553.html

  • XMP metadata lost in PNG files

    Hello,
    My XMP metadata is lost from a PNG file if the file is modified and saved. Here is what I am doing
    1. Put some metadata in a PNG file using m_xmpFile.OpenFile( FileName, kXMP_PNGFile , kXMPFiles_OpenForUpdate)
    2. Edit this file in Photoshop (changed the brightness and contrast of the file)
    3. Saved the the modified files.
    All my XMP metadata is now lost fromt the file.
    is my implementation wrong? Is there some other way to stamp metadata in PNG files?
    Thanks,
    Hitesh

    Info: Mac, Yosemite, Bridge CC
    I have an extensive collection of PNG files that HAD been keyworded in Bridge (XMP). I noticed several days ago that the XMP of all those files is now missing.
    When attempting to assign keywords back in, I also get the message: "The file ####.png canot store XMP metadata. No changes will occur." Weird. Like you said, it's looking like a bug.
    And here's the kicker... if I duplicate the PNG file (Edit > Duplicate), the "copy" DOES contain the original XMP that went missing.
    I really don't want to have to manually duplicate all my PNG files just to regain the metadata. Any brainy solution? I'm attaching an example of the original PNG (missing XMP) and the duplicated PNG (magically restored XMP).

  • XMP metadata lost from PNG files after saveing

    Hello,
    i am using Photosop CS3 SDK. through my plug-in I put some metadata in the file using XMP SDK 4.4.2.
    For PNG files, if the file is modified and saved, all the XMP metadata is lost from the file.
    The following steps are being done.
    1. Put some metadata in PNG file using SXMPMeta::SetProperty and SXMPMeta::AppendArrayItem
    2. modify the file (changed brightness, contrast, flattened the image).
    3. Save this file.
    After saving all the xmp metadata is lost from the PNG file. This works for all other formats.
    What can be wrong that I am doing?
    Is there any other way to put XMP metadata in file?
    Thanks,
    Hitesh

    That's probably because PNG doesn't save or read XMP metadata.
    There really aren't standards for metadata in PNG. (though a few products have tried adding it in ad-hoc ways, without documenting their efforts)

Maybe you are looking for

  • How come some of my older music that I downloaded before does not play anymore?

    I changed my Apple ID to a more current email address and my name to my name instead and I don't know if this is the cause as to why I can't listen to some older music I bought with the original Apple ID. If you guys can help me out, that'd be great!

  • What can be done to enable multiple usb  "mouse" buttons  in Solaris 10 ?

    My usb multimedia keyboard is recognized as a "combined" usb device. Two /dev/usb/hidx are created , one with usb keyboard driver attached, the other with the usb mouse driver attached. Events are generated for the scroll wheel on the keyboard, but n

  • Save File Dialog KO

    Hi, I'm using the Save File Dialog KO (AW7) and would like to set a user selectable default directory. I've tried entering a variable set with the appropriate path in the 'Begin Browsing From - Other' text box in the KO setup but this doesn't seem to

  • Visibroker and Managed Server problem

    Hi, I have a webapp that connects to a Visibroker (3.4) server for getting some information. When the application is deployed on the admin server itself everything runs fine. I'm not modifying any of the scripts for this. But when I deploy the applic

  • Implement OLAP Datagrid in flex2

    Actually olap datagrid is a component in flex 3. but i want to implent this datagrid in flex 2. If any one have any idea or any help link is avaliable in web plz send me. Thanks in advance. Niranjan Swain.