Skip to main content
JR Boulay
Community Expert
Community Expert
Nov 27, 2017 10:34 AM UTC
Answered

List and count attachments

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 is closed to new replies. Start a new post to keep the conversation going.
try67
try67Correct answer
Community Expert
Nov 27, 2017 1:47 PM UTC

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

}

6 replies

try67
Community Expert
Community Expert
Nov 27, 2017 1:08 PM UTC

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

Translate
JR Boulay
Community Expert
JR BoulayCommunity ExpertAuthor
Community Expert
Nov 27, 2017 1:35 PM UTC

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

Translate
Acrobate du PDF, InDesigner et Photoshopographe
try67
Community Expert
try67Community ExpertCorrect answer
Community Expert
Nov 27, 2017 1:47 PM UTC

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

}

Translate