• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers

Remove or detete method for document metadata

New Here ,
May 13, 2021 May 13, 2021

Copy link to clipboard

Copied

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?

TOPICS
Acrobat SDK and JavaScript

Views

91

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 14, 2021 May 14, 2021

Copy link to clipboard

Copied

Hi,

 

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

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 16, 2021 May 16, 2021

Copy link to clipboard

Copied

LATEST

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.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines