List and count attachments

Adobe Community Professional ,
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.

Most Valuable Participant
Correct answer by try67 | Most Valuable Participant

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);

}

TOPICS
Acrobat SDK and JavaScript

Views

861

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

List and count attachments

Adobe Community Professional ,
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.

Most Valuable Participant
Correct answer by try67 | Most Valuable Participant

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);

}

TOPICS
Acrobat SDK and JavaScript

Views

862

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
Nov 27, 2017 0
Most Valuable Participant ,
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?

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
Reply
Loading...
Nov 27, 2017 0
Adobe Community Professional ,
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

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
Reply
Loading...
Nov 27, 2017 0
Most Valuable Participant ,
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);

}

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
Reply
Loading...
Nov 27, 2017 0
Adobe Community Professional ,
Nov 27, 2017

Copy link to clipboard

Copied

Thank you very much.

I missed it in the documentation.

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
Reply
Loading...
Nov 27, 2017 0
New Here ,
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!

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
Reply
Loading...
Jun 17, 2019 0
try67 LATEST
Most Valuable Participant ,
Jun 17, 2019

Copy link to clipboard

Copied

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

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
Reply
Loading...
Jun 17, 2019 0