3 Replies Latest reply on Aug 8, 2012 6:35 AM by Gonterman1201

    Edit Metadata w/javaScript?

    Gonterman1201 Level 1

      My question is can this be done. I have been able to add metadata to a document in Indesign using a script however the document gets exported as seperate pages to PDF. So I am wondering if I can edit the metadata once its exported to reflect the single page info.


      Thanks Brett G.

        • 2. Re: Edit Metadata w/javaScript?
          David W. Goodrich Level 3

          In Acrobat 9 Pro, the Document Properties button "Additional Metadata" reveals a different "Advanced" from the tab with the same name available under Document Properties.  This more hidden Advanced lets one save and import the XMP metadata.  Thus one can export a PDF's XMP metadata, tweak it in a text editor, and stick it back.  Tony Hammond blogged about modifying XMP metadata as early as 2007, describing some of the issues in doing so programmatically, some of which are embodied in the open-source tool pdfmark.



          • 3. Re: Edit Metadata w/javaScript?
            Gonterman1201 Level 1

            I have given up trying to adjust the metadata from Acrobat. I have come up with a solution that works before its made into a pdf changing the data in the indesign document before each page is exported.


            for(var myCounter = 0; myCounter < myDocument.pages.length; myCounter++){
                        myPageName = myDocument.pages.item(myCounter).name;
                        app.pdfExportPreferences.pageRange = myPageName;
                        with (myPoo){
                        if (ExternalObject.AdobeXMPScript == undefined) {
                        ExternalObject.AdobeXMPScript = new
                        xmp = new XMPMeta();
                        var myNewColor=setProperty("http://www.hjedesign.com/metadata/1.0/", "Color", selectedColor,);
                        var myNewYear=setProperty("http://www.hjedesign.com/metadata/1.0/", "year",  selectedYear,);
                        var myNewSize=setProperty("http://www.hjedesign.com/metadata/1.0/", "trimSize", selectedSize,);
                        var myNewSize=setProperty("http://www.hjedesign.com/metadata/1.0/", "specialInstructions", selectedInst,);
                        if ((myPageName.length<3)&&(myPageName.length>1)){
                        if ((myPageName.length<2)&&(myPageName.length>0)){
                        myFilePath = "~/Desktop" + "/" + myJobNum +"-"+"000"+"-"+selectedYear.slice(2,4)+ "_" + myPageName + ".pdf";
                        myFile = new File(myFilePath);
                        myDocument.exportFile(ExportFormat.pdfType, myFile, false,"KC PDFprint");