Adding XMP metadata into new illustrator document

var app:Application = Illustrator.app;
var doc:Document = app.activeDocument;
var xmpString:String = doc.XMPString;
var xmpMeta : XMPMeta = new XMPMeta(xmpString);                       
var myNamespace : Namespace = new Namespace("test", "http://test.thisiscool");
xmpMeta.myNamespace::stringName = "supercool";
var tmp : String = xmpMeta.serialize();
doc.XMPString = tmp;
If I execute the above code block I end up with the following metadata inside the document:
<rdf:Description rdf:about=""
            xmlns:ns1="http://test.thisiscool">
         <ns1:stringName>supercool</ns1:stringName>
      </rdf:Description>
Why is the prefix defaulted to ns1 when I specified that it should be "test"?
The documentation says you can register your own custom prefixes. But it doesn't say weather it's possible to do that programatically.  Is it?  If not, how is it done?:
Prefixes are not stored in the data model, but only in namespace URIs. The parser collects the namespace prefixes, to be used when the same XMPMeta object is serialized after modification. For the Adobe standard namespaces, defined in the XMP Specification: Part 2, Standard Schemas, the default namespaces are stored in a global namespace registry of the library. You can also register custom prefixes for your own namespaces; if the serializer does not find a registered prefix for a certain namespace, it generates prefixes of the form "ns1", "ns2" and so on.

The CS SDK forum is actually probably more correct, but this is probably an Illustrator scripting question.
You might be able to add the namespace using the XMP Namespace Designer, but I'm not sure...
Harbs

Similar Messages

  • Incrementally appending  custom XMP metadata into PDF files

    I have a problem writing custom XMP metadata into a PDF document (I'm using the XMP Toolkit SDK).
    The problem is that I don't know whether is possible to expand the XMP packet in order to append metadata incrementally into the document, and, if it is possible, I don't know how to do it. The program I wrote succesfully appends an item to an array four times, but it fails when trying to append the fifth one. The reason obviously is that the packet gets full and there is not room for more metadata. The error message, if I force the PutXMP call, is:
    ERROR: Can't fit into specified packet size
    So, what can I do? How to enlarge the packet or make it expandable? Or, otherwise, have I to inject a new XMP packet with the up-to-date information in it? How?
    And a last question: Have I to scan for packets when dealing with PDF files? No smart handlers are available for this kind of files?
    Thanks in advance.
    Xabier Artola.
    Univ. of the Basque Country.

    Were you able to find a solution to this problem? I am having the same issue.
    Jason

  • Placed an image in a new Illustrator document.  Tried to change the Output Mode in the Output Dialog but could not select "Separations Mode".

    Placed a DCS2 document image in a new Illustrator document. 
    Tried to change the Output Mode in the Output Dialog but could not select "Separations Mode".

    I would check with the makers of ULTRASEPS.
    I never heard of it, just checked their website, I don't think they support Illustrator:
    What do I need to use UltraSeps?
    UltraSeps requires Adobe Photoshop version CS2 or higher on Windows and Macintosh.
    Its also 100% compatible with Photoshop Creative Cloud and Creative Cloud 2014.

  • Can you export images which have been pasted into an Illustrator document as separate files?

    I have a multi-page Illustrator document (over 50 artboards) which contains lots of images that are all saved within the document (not linked in from seperate files) and all the images need to be exported as separate image files (similar to when you package a file in Indesign). The problem is the files are not linked, they are all saved within the document.
    Want to avoid having to copy + paste every image into a new document in Photoshop and save individually as this will take forever.

    Save the document as a PDF and Open in Photoshop. Select only the Images in the Open dialog and proceed from there.

  • Can I automate the writing of XMP metadata into JPEG and TIFF files?

    I have written an ASP.NET 3.5 website application on behalf of an annual international photographic competition. Entrants will be uploading digital photos in either JPEG or TIFF format. Ideally, I would write entrant identity and image title information into the XMP metadata for each image immediately after upload - but so far, I have failed to find any way to do this in ASP.NET.
    Thousands of images are involved, so I need to find a way to automate the metadata insertion, perhaps with some sort of script that uses a text file (extracted from the SQL Server database on my website) as the source of the metadata for a batch of images. Is this the sort of task that can be done by writing a script for Bridge CS3? Are there any scripts already in existence that I could use? I am a total beginner in this area.
    I use a Win XP PC, though I have a colleague who, I think, has CS3 on his Mac (running under the Leopard OS), so scripts for either platform might be usable.
    David

    You are the man X!
    Ok here is another version with a check for the dll.
    #target bridge 
       if( BridgeTalk.appName == "bridge" ) {
    addInfo = new MenuElement("command", "Update Entry Details", "at the end of Thumbnail");
    addInfo .onSelect = function () {
         main();
    function main(){
    var csv = File.openDialog("Please select CSV file.","CSV File:*.csv");
    if(csv != null){
    loadXMPScript();
    csv.open("r");
    while(!csv.eof){ 
       strInputLine = csv.readln();
       if (strInputLine.length > 3) {
          strInputLine = strInputLine.replace(/\\/g,'/');
       inputArray  = strInputLine.split(",");
       var csvFile = new File(inputArray[0]);
       var title = inputArray[1];
       var author = inputArray[2];
    if(!csvFile.exists) {
    alert(csvFile + " Does not exist"); //////////Check if file exists
    return;
    if(csvFile.exists){
    var file = new Thumbnail(csvFile);
    try{
    var xmpFile = new XMPFile(file.path, XMPConst.UNKNOWN,XMPConst.OPEN_FOR_UPDATE);
    }catch(e){
          alert("Problem opening xmp for update:-\r" + file.path +"\r" +e.message);
          return;
    try{
    var xmp = xmpFile.getXMP();
    }catch(e){
          alert("Problem opening xmp data:-\r"  + e.message);
          return;
    xmp.deleteProperty(XMPConst.NS_DC, "creator");
    xmp.deleteProperty(XMPConst.NS_DC, "title");
    try{
    xmp.appendArrayItem(XMPConst.NS_DC, "creator", author, 0,XMPConst.ARRAY_IS_ORDERED);
    xmp.appendArrayItem(XMPConst.NS_DC, "title", title, 0,XMPConst.ARRAY_IS_ORDERED);
    }catch(e){
          alert("Problem writing xmp data:-\r"  + e.message);
          return;
    if (xmpFile.canPutXMP(xmp)) {
    xmpFile.putXMP(xmp);
    }else{
    alert("Can not write new metadata to " + csvFile.spec); 
    xmpFile.closeFile(XMPConst.CLOSE_UPDATE_SAFELY);
    unloadXMPScript();
    function loadXMPScript()
       var results = new XMPLibMsg("XMPScript Library already loaded", 0, false);
       if (!ExternalObject.AdobeXMPScript)
          try
             ExternalObject.AdobeXMPScript = new ExternalObject('lib:AdobeXMPScript');    
             results.message = "XMPScript Library loaded";
          catch (e)
             alert("Could not load AdobeXMPScript \r" + e.message);
             results.message = "ERROR Loading AdobeXMPScript: " + e;
             results.line = e.line;
             results.error = true;
       return results;
    function unloadXMPScript()
       var results = new XMPLibMsg("XMPScript Library not loaded", 0, false);
       if( ExternalObject.AdobeXMPScript )
          try
             ExternalObject.AdobeXMPScript.unload();
             ExternalObject.AdobeXMPScript = undefined;
             results.message = "XMPScript Library successfully unloaded";
          catch (e)
             results.message = "ERROR unloading AdobeXMPScript: " + e;
             results.line = e.line;
             results.error = true;
       return results;
    function XMPLibMsg (inMessage, inLine, inError)
       this.message = inMessage;
       this.line = inLine;
       this.error = inError;

  • How do you import  (or convert) XMP metadata into iPhoto '08?

    Having recently made OS X my primary operating system, I switched from using Picasa/Windows Photo Gallery on Vista to catalogue my photos to iPhoto '08. However, the 7,000+ pictures I have all have XMP metadata tags. None of them show up in iPhoto '08 after import. Needless to say, I am not looking forward to having to retag 7,000+ pictures in iPhoto.
    I know people in various forums, here and elsewhere, have said that iPhoto '08 does not do XMP at all. Is this true? Is there a workaround or plugin? I find it weird that XMP has been an open standard since May, and 6 months later, there isn't a plugin or solution, especially from Apple. Unless I am just daft and missing something obvious, which is entirely possible.
    At any rate, I would really appreciate any help in me not having to retag over 7,000 pictures...thanks in advance!

    mrbofus:
    Do you still have the PC and the photos on it? If so you might look into the demo version of iView MediaPro and see it if can read those Picasa files and embed the metadata into the files like it can when reading an iPhoto library on the Mac platform. If it can, you'll be able to write the metadata to the files and bring them over again to the Mac and import into a new library. This is only speculation as I'm not conversant in Windows at all.
    Do you Twango?
    TIP: For insurance against the iPhoto database corruption that many users have experienced I recommend making a backup copy of the Library6.iPhoto database file and keep it current. If problems crop up where iPhoto suddenly can't see any photos or thinks there are no photos in the library, replacing the working Library6.iPhoto file with the backup will often get the library back. By keeping it current I mean backup after each import and/or any serious editing or work on books, slideshows, calendars, cards, etc. That insures that if a problem pops up and you do need to replace the database file, you'll retain all those efforts. It doesn't take long to make the backup and it's good insurance.
    I've created an Automator workflow application (requires Tiger), iPhoto dB File Backup, that will copy the selected Library6.iPhoto file from your iPhoto Library folder to the Pictures folder, replacing any previous version of it. It's compatible with iPhoto 08 libraries and Leopard. iPhoto does not have to be closed to run the application, just idle. You can download it at Toad's Cellar. Be sure to read the Read Me pdf file.

  • Embedding extended XMP metadata into a PDF file

    Hello.
    I am preparing a thesis for submission into our library repository. They keep some additional information about the paper in a separate XML file which looks like: http://naca.central.cranfield.ac.uk/ethos-oai/2.0/uketd.xml
    The metadata can be then easily harvested by other libraries etc.
    Because the papers are downloadable and can freely circulate over the Internet I would like to also include the metadata into the PDF itself.
    I've managed to extend the PDFX (MiKTeX) package such that it writes custom metadata in addition to the default fields (Author, Title, Subject, Keywords) into the PDF.
    The problem is that the library metadata (see above) makes use of XSI schema which is apparently not compatible with RDF format of XMP.
    Is there a way to get such rich metadata sets into a PDF file in a portable and accessible (thinking about search engines) way or should I stick with plain Simple Dublin Core?
    Thanks for recommendations.

    You may want to repost this in the XMP SDK forum:  http://forums.adobe.com/community/design_development/xmp_sdk

  • Multiple XMP Metadata into Multiple PDF

    Hi, recently I've been trying to change the xmp metadata of multiple pdf, I already tried using Bridge and some other 3rd Party Programs but the issue is that all of those solutions just change the same information into multiple files, and what I want is to change different information into multiple files...
    is there a way to load the info from a *.csv or a *.xmp
    to be more precise I'm trying to change the Title Metadata of a tons of PDF but every file has a different Title... how can I do it massively?

    You may want to repost this in the XMP SDK forum:  http://forums.adobe.com/community/design_development/xmp_sdk

  • How do you embed/inject xmp metadata into a mpeg 2 video file?

    Im looking to add keywords and descriptions to original file (raw MPEG-2) and have the metadata stick when i go to the transcoding process and batch convert the orginal file to either a wmv and flash file. how can i achive this? what tools are available ? and or is this a custom job? any info and or programmers looking to test this im open to all the help i can get.

    Yeah I kind of figured that. I've been trying various ways of trying to batch inject metadata into video files and thought I would start with the master file but because of the limitations the raw digitized mpg 2 video file has. In that case I have yet to find a transcoding program that will batch out various formats and read a xmp side car file to inject the metadata into the outputted file (does anyone know if Adobe media encoder 4 can accomplish this where a xmp sidecar file is created then transcoding into a wmv and or flash file , curious if the metadata will stick and be read in the outputted file) In anycase  I may have find an alternative way and use my current Rhozet carbon coder transcoder program to try to inject an xml file during the batch transcoding process. If anyone has successfully accomplished this with injecting xmp metadata in a batch transcoding program please let me know. I've been exhausted searching for the solution this problem for a long time and I don’t want to wait till a mpeg 7 solution comes out.

  • XMP metadata in active indd document

    Is there any possibility to add XMP metadata in the active InDesign document using scripting?
    Thanks
    SS

    Hi Sankar,
    You can use the Scripting guide example below here.
    var myDocument = app.activeDocument;
    with (myDocument.metadataPreferences){
    author = "Adobe";
    copyrightInfoURL = "http://www.adobe.com";
    copyrightNotice = "This document is copyrighted.";
    copyrightStatus = CopyrightStatus.yes;
    description = "Example of xmp metadata scripting in InDesign CS";
    documentTitle = "XMP Example";
    jobName = "XMP_Example_2003";
    keywords = ["animal", "mineral", "vegetable"];
    //The metadata preferences object also includes the read-only
    //creator, format, creationDate, modificationDate, and serverURL
    //properties that are automatically entered and maintained by InDesign.
    //Create a custom XMP container, "email"
    var myNewContainer = createContainerItem("http://ns.adobe.com/xap/1.0/", "email");
    setProperty("http://ns.adobe.com/xap/1.0/", "email/*[1]", "[email protected]");
    thx
    csm_phil

  • How to insert xmp metadata into jpeg files?

    Hi
    Is it possible to automatically insert the metadata
    with the script using text extracted from my database.
    I have to insert the metadata into lots of images which are uploaded to a site.
    Thanks
    [signature deleted bu host]

    A scripting tool you may use, although complex, is ImageMagick.  It allows loads of image manipulate but also handles data.
    Another options is DBGallery, which will very easily allow XMP data to be written to hundreds or thousands of files at a time, but not via script (it's a Windows application).  You can see a quick screenshot tour of it's IPTC/XMP capabilities here.
    Hope this helps,
    Glenn
    Developer of DBGallery: The Photo DATAbase

  • Place an SVG into an illustrator document through Javascript(Extendscript)

    Hi,
    I'm trying to place an svg in illustrator using extendscript. Here's basically what I'm doing
    var doc = app.documents.add(); var p = doc.placedItems.add(); p.file = new File(svgfilepath);
    This fails with the error
    File is in a format that cannot be placed
    I am able to place the same file manually using File > Place. Am I missing some thing? Need help!
    [SO Link]

    Hi, try the following:
    // Reference: https://forums.adobe.com/thread/1722322
    // Assumes you have an open Illustrator document
    // and an SVG file on your desktop named: testSVG.svg
    // Basic Example:
    // Tested and worked in Illustrator CS5 / OS X
    var doc = app.activeDocument;
    var svgFile = File(Folder.desktop + '/testSVG.svg');
    doc.groupItems.createFromFile(svgFile);
    Tell Jongware at "SO" hello, and that he is right about the Illustrator JS Team. ;-) Also for future reference, we have an Illustrator Scripting forum here.

  • Using a pattern previously made in an illustrator document and making it show up on another new illustrator document

    I made a pattern in illustrator last week and saved it. Now i have another assignment that i opened new and I want to make it show up in this new illustrator. Is that possible?

    In addition to Ton reply please refer following help on using and creating swatches.
    https://helpx.adobe.com/illustrator/using/using-creating-swatches.html
    Regards,
    Sumit Singh

  • Batch combine files into one illustrator document - how to open target document?

    I am making a script which will:
    1) Open a folder of Illustrator files
    2) Open each file in the folder (these files are called the source files)
    3) Select all the contents of the source file
    4) Copy the contents of the source file
    5) Paste these contents into a target file as a new layer
    6) Ensure the new layer has the same name as the old source file
    However, I don't know how to tell Illustrator where my target file is. How can I do this?
    Also, when I paste, how can I turn off paste rembers layers. (So the layers get pasted into the new layer that has the same name as the old document).
    Here is my code:
    // JavaScript Document
    //Set up vairaibles
    var destDoc, sourceDoc, sourceFolder;
    // Select the source folder.
    sourceFolder = Folder.selectDialog('Select the folder with Illustrator files that you want to mere into one', '~');
    // If a valid folder is selected
    if (sourceFolder != null) {
              files = new Array();
              // Get all files matching the pattern
              files = sourceFolder.getFiles();
              if (files.length > 0) {
                        // Get the destination to save the files
                        destDoc = document.selectDialog('Select the final saved document', '~');
                        for (i = 0; i < files.length; i++) {
                                  sourceDoc = app.open(files[i]); // returns the document object
                                  var myLayers = sourceDoc.layers; // All layers in Active Document
                                  //Go through all layers of source document and copy artwork
                                  for (i = 0; i < myLayers.length; i++) {
                                            myLayers[i].hasSelectedArtwork = true;
                                  with(sourceDoc) {
                                            var count = pageItems.length;
                                            for (var i = 0; i < count; i++) {
                                                      pageItems[i].selected = true;
                                            redraw();
                                            copy();
                                            for (var i = 0; i < count; i++) {
                                                      pageItems[i].selected = false;
                                  //Create a new title variable that has the title of the source document
                                  var title = sourceDoc.name;
                                  var title = title.substring(0, title.length - 4); //(remove extension from name)
                                  //Close the Source Document
                                  sourceDoc.close(SaveOptions.DONOTSAVECHANGES);
                                  //Open the Destination Document and create a new layer in it that is named after the title variation
                                  var newLayer = destDoc.layers.add();
                                  newLayer.name = title;
                                  //Paste into this new layer
                                  destDoc = app.paste();
              else {
                        alert('No matching files found');
    Thanks in advance for any help   
    Edit: Also, when pasting, how can I paste in place instead of just pasting.

    I have been studying this script. It is similar to what I need except it places the source files (Instead of copying & pasting them)
    http://kelsocartography.com/blog/?p=204
    I have adapted the script to my needs and it works perfectly, except it has the same problem as before: It pastes the first source file, but then it endlessly starts pasting the second source file (in a loop) and so I have to force quit.
    So my new question is, when looping through files how can you get illustrator to move on the next one?
    The original kelsocartography had this line:
    thisPlacedItem = newLayer.placedItems.add()
    thisPlacedItem.file = imageList[i];
    I belive this line is what makes Illustrator move onto the next file, but I am not sure how to adapt it to my code.
    Here is my code so far:
    function getFolder() {
              return Folder.selectDialog('Please select the folder to be imported:', Folder('~'));
    function importFolderAsLayers(selectedFolder) {
              // if a folder was selected continue with action, otherwise quit
              var myDocument;
              if (selectedFolder) {
                        myDocument = app.documents.add();
                        var firstImageLayer = true;
                        var newLayer;
                        var thisPlacedItem;
                        // create document list from files in selected folder
                        var documentList = selectedFolder.getFiles();
                        for (var i = 0; i < documentList.length; i++) {
                                  // open each document in file list
                                  if (documentList[i] instanceof File) {
                                            // get the file name
                                            var fName = documentList[i].name.toLowerCase();
                                            var sourceDoc = app.open(documentList[i]); // returns the document object
                                            var myLayers = sourceDoc.layers; // Select All layers in Active Document
                                            //Go through all layers of source document and copy artwork
                                            for (i = 0; i < myLayers.length; i++) {
                                                      myLayers[i].hasSelectedArtwork = true;
                                            with(sourceDoc) {
                                                      var count = pageItems.length;
                                                      for (var i = 0; i < count; i++) {
                                                                pageItems[i].selected = true;
                                                      redraw();
                                                      copy();
                                                      for (var i = 0; i < count; i++) {
                                                                pageItems[i].selected = false;
                                            //Create a new title variable that has the title of the source document
                                            var title = sourceDoc.name;
                                            var title = title.substring(0, title.length - 4); //(remove extension from name)
                                            //Close the Source Document
                                            // check for supported file formats
                                            if ((fName.indexOf(".eps") == -1)) {
                                                      continue;
                                            } else {
                                                      if (firstImageLayer) {
                                                                newLayer = myDocument.layers[0];
                                                                firstImageLayer = false;
                                                      } else {
                                                                newLayer = myDocument.layers.add();
                                                      // Give the layer the name of the image file
                                                      newLayer.name = fName.substring(0, fName.indexOf("."));
                                                      // Place the image on the artboard
                                                      sourceDoc.close(SaveOptions.DONOTSAVECHANGES);
                                                      //Paste into this new layer
                                                      newLayer = app.paste();
                        if (firstImageLayer) {
                                  // alert("The action has been cancelled.");
                                  // display error message if no supported documents were found in the designated folder
                                  alert("Sorry, but the designated folder does not contain any recognized image formats.\n\nPlease choose another folder.");
                                  myDocument.close();
                                  importFolderAsLayers(getFolder());
              } else {
                        // alert("The action has been cancelled.");
                        // display error message if no supported documents were found in the designated folder
                        alert("Rerun the script and choose a folder with images.");
                        //importFolderAsLayers(getFolder());
    // Start the script off
    importFolderAsLayers(getFolder());

  • Is there a way to insert comments directly into an Illustrator document so that every time you expor

    I use Illustrator a lot to create website designs, and pepper the PDFs with comments on how everything should work. Is there a way to have those comments embedded into the AI so that I don't have to enter in the comments every time I export a PDF?

    Template are the pre-designed document in which you do the modification as per the need.
    this will give you better idea..
    http://help.adobe.com/en_US/illustrator/cs/using/WS714a382cdf7d304e7e07d0100196cbc5f-6330a .html
    So , you can create a template with the comment on it.
    when creating the new file , base it upon the template so that you have the comment already present in the Ai.

Maybe you are looking for

  • After 10.3.9 update, unable to complete any operation requiring LDAP data

    Hi all -- I recently ran a bunch of updates on my 10.3.9 Server, most notably, Security Update 2005-008. After doing so, the machine behaved erratically. One day later, I noticed that LDAP service had stopped. I was unable to authenticate to it. Afte

  • Why does my cursor jump from photoshop window to the file window im working on

    I started experiencing this following problem when I upgraded my macbook pro to Lion OS When I open PhotoShop CS4, I open a new file and the window appears so I could start working, but then I move the cursor to the white or "gray and white checker"

  • Typing issue on ipad mini

    On my old ipad when I touched a spot where I needed to type the screen would move and I could follow along while I was typing. On my ipad mini the screen doesn't move and I can't see what I am typing. What do I do?

  • ORACLE 9iR2 OMS On SuSE 8

    I have installed ORACLE 9i R2 on SuSE with no errors.And I have configured my OMS with no errors.But when I use "oemctl start oms" to start OMS,it said "Time out to start oms,......checking oem.nohup".I opened the oem.nohup,it said /usr/bin/nice /opt

  • Communication channel - standard t-code/table

    Hi, Need some help... Is there any standard t-code by which we can start/stop/automate mass communication channel at a time ? or Any t-code by which we can start/stop/automate single communication channel ? (I mean w/o going to moni_ifr -> rwb -> ...