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

List and count attachments

Community Expert ,
Nov 27, 2017 Nov 27, 2017

Copy link to clipboard

Copied

Hi.

Is there a way to list and/or count all attachments in a PDF file?

I'd like the output in the Console or in a text file, it's for files comparison purpose (they contain dozens of attachments).

Thank you.

TOPICS
Acrobat SDK and JavaScript

Views

1.7K

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

correct answers 1 Correct answer

Community Expert , Nov 27, 2017 Nov 27, 2017

They can be accessed via the dataObjects property, like this:

console.println("Number of attachments: " + this.dataObjects.length);

for (var i=0; i<this.dataObjects.length; i++) {

     console.println("Attachment #"+i+": " +this.dataObjects.name);

}

Votes

Translate

Translate
Community Expert ,
Nov 27, 2017 Nov 27, 2017

Copy link to clipboard

Copied

What kind of attachments? Ones created using the File Attachments commenting tool, and/or using the Attachments panel?

Votes

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 ,
Nov 27, 2017 Nov 27, 2017

Copy link to clipboard

Copied

Using the Attachments panel with Acrobat Pro DC.

A Dropbox-like cloud backup that I use has made several versions ("Copy of…") of the same file, so I need to compare their content, which is attachments only

Votes

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 ,
Nov 27, 2017 Nov 27, 2017

Copy link to clipboard

Copied

They can be accessed via the dataObjects property, like this:

console.println("Number of attachments: " + this.dataObjects.length);

for (var i=0; i<this.dataObjects.length; i++) {

     console.println("Attachment #"+i+": " +this.dataObjects.name);

}

Votes

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 ,
Nov 27, 2017 Nov 27, 2017

Copy link to clipboard

Copied

Thank you very much.

I missed it in the documentation.

Votes

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 ,
Jun 17, 2019 Jun 17, 2019

Copy link to clipboard

Copied

Sorry to hijack this old post. I have some files that were created using the File Attachments commenting tool. How can I

1. Get a list of the Files

     I tried using the Annotation object, but I couldn't find a property that will show me the name of the file.

     var annots = this.getAnnots();
for (var i = 0; i < annots.length; i++) {
   console.println (annots.name);

}

2. Save the files individually to local drive.

Thanks!

Votes

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 ,
Jun 17, 2019 Jun 17, 2019

Copy link to clipboard

Copied

LATEST

I don't believe that either of those things is possible using a script.

Votes

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