Author Topic: Javascript and deleting namespaces/custom fields  (Read 2206 times)

0 Members and 1 Guest are viewing this topic.


  • Newbie
  • *
  • Posts: 6
Javascript and deleting namespaces/custom fields
« on: December 26, 2021, 04:03:03 PM »
I use Adobe's action scripts (javascript)  to automate populating custom fields.  I have hundreds of documents with custom fields that are 'orphaned.'  What I mean by this is that the document's namespace assigned to a custom field is no longer corresponds to the current namespaces in PDFE.

Instead of opening each file and manually deleting each entry under the Custom tab in Document Properties, I would like to create an action script that will batch process such files.  However, in my own research and  inquiries in user groups as well as trial and error , I am lead to believe that there is not a Javascript Adobe API method that can do this.

I'm not even sure I understand the object model for these custom fields other than its based on XML.  Looking at XML programming, that seems like an added learning curve.

Does know anyone know of an Adobe API method that can iterate through the custom fields and remove them?



  • Administrator
  • *****
  • Posts: 907
Re: Javascript and deleting namespaces/custom fields
« Reply #1 on: December 27, 2021, 07:01:03 PM »
You indeed will need to manipulate the Extensible Metadata Platform (XMP) data you get from the doc.metadata property. Acrobat JavaScript supports ECMAScript for XML (E4X), so it's not that difficult. There is also the Adobe XMP toolkit (there are ports for scripting languages), to manipulate the XMP data easily.

But, for that need in particular, you can use PDF Explorer to export to a csv file the metadata properties you want to keep, run the Anonymize tool and then import the exported properties back to the PDF file.