Skip to main content
JR Boulay
Community Expert
Community Expert
November 27, 2017
Answered

List and count attachments

  • November 27, 2017
  • 1 reply
  • 2241 views

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.

This topic has been closed for replies.
Correct answer try67

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

}

1 reply

try67
Community Expert
Community Expert
November 27, 2017

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

JR Boulay
Community Expert
JR BoulayCommunity ExpertAuthor
Community Expert
November 27, 2017

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

Acrobate du PDF, InDesigner et Photoshopographe
try67
Community Expert
try67Community ExpertCorrect answer
Community Expert
November 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);

}