Skip to main content
Participating Frequently
April 25, 2016
Answered

Want to extract document metadata and doc info via a script

  • April 25, 2016
  • 1 reply
  • 5535 views

I'm not a Javascript nor Java programmer so I might be missing one or more steps.

Looking at the Javascript info I have I see the following code:

var r = new Report();

r.writeText(this.metadata);

r.open("myMetadataReportFile");

save("/c/myreport.pdf"));

The code doesn't seem to be working when run from the console. If I execute "this.metadata" I get the information that I expect. This suggests that the problem is with report creation and or saving the document.

I haven't yet figured out how to get information out of the Doc Info dictionary.  This is another need.

NOTE: In both cases (XMP and DocInfo) we're adding CUSTOM metadata.

Ideally I'd like to save both sets of information XMP and DocInfo as XML . This way we can run a comparison between the two.

Finally whatever code I end-up with needs to be able to run in the Action Wizard over about 10,000 files. If the input file is "file.pdf" the output should be "file.xml"

Thanks.

Ira

This topic has been closed for replies.
Correct answer try67

OK. I figure out what my problem was. I need to press ctrl-enter on each line.

So how do I take the code and make it run on a batch of files? Is it as simple as putting the code in the Action Wizard?

If yes, how do I access all the information in the DocInfo Dictionary (both normal and custom)?

Thanks


To run multiple lines in the console you need to select them all with the

mouse and then press Ctrl+Enter.

Later on you can place the code as a part of an Action and run it like

that, yes.

The "metadata" property should return the full XMP file, including any

custom properties.

1 reply

try67
Community Expert
Community Expert
April 25, 2016

Let's start from the end: You will not be able to run an Action on 10,000 files in a single go. If that's your goal then you should abandon it now and look for an alternative to Acrobat, as it simply can't handle that many files without hanging or crashing.

Processing 500 files should be taken as the maximum amount possible.

ipolansAuthor
Participating Frequently
April 25, 2016

Thanks I didn't realize that Acrobat had such a limit. But even if we have to do this 200 files at a time it is worthwhile doing.

How do we accomplish that?

ipolansAuthor
Participating Frequently
April 26, 2016

I would have expected not to get "undefined".

When I ran:

var r = new Report();

r.writeText(this.metadata);

r.open("myMetadataReportFile");

And the console responded with:

GeneralError: Operation failed.

Report.open:1:Console undefined:Exec

undefined

It did NOT OPEN a file.


OK. I figure out what my problem was. I need to press ctrl-enter on each line.

So how do I take the code and make it run on a batch of files? Is it as simple as putting the code in the Action Wizard?

If yes, how do I access all the information in the DocInfo Dictionary (both normal and custom)?

Thanks