Skip to main content
Participating Frequently
May 13, 2021
Question

Remove or detete method for document metadata

  • May 13, 2021
  • 1 reply
  • 932 views

Hi folks.

First time posting in this community.

I have a large library of PDF's. I have been creating and populating custom document metadata for each file using javascript containing barebones code such as:

this.info.Name1 = "ACME Company";
this.info.Name2 = "1500";
this.info.Name3 = "2021-01-01"; . . .

and then run it as a batch script.

Through occassional sloppy coding, sometimes the custom property becomes

this.info.Nmae1 = "ACME Company"; //or//
this.info.2Name = "2000"

To fix these mistakes, I'll write a script with the line

this.info.Nmae1 = null;
this.info.2Name = null;

I checked this snippet in the javascript console and I can see it has removed the offending document data object but the change is not persistent.  After I save and close the document, it remains.  After each console entry I check it in the Documents Property → Custom Tab to discover it has not been removed.

 

In some documents, I have a long list of metadata objects that are not really related to the document and become orphans.

 

Manually deleting the offending entry in the Document Properties modal box using the Delete button is the only methodology I that works.  Not a very efficient way to go about this task.

 

Is there document method that will remove these orphaned metadata?

This topic has been closed for replies.

1 reply

BarlaeDC
Community Expert
Community Expert
May 14, 2021

Hi,

 

You might have more success using the metadata properties as this gives you direct access to the XMP metadata.

EddieJPAuthor
Participating Frequently
May 16, 2021

I researched xmp files after discovering I could use the app directly to save/export metadata , change/delete a line item with an editor followed by importing or replacing it with the edited xmp file.

 

Coding these steps into a javascript looks a bit more daunting.  I took a look at Example 3 which adds a few entries.  I'll have a learning curve but your suggestion is probably the best one.