Skip to main content
kellya41859936
Participant
April 25, 2016
Answered

Button/Javascript to attach MULTIPLE files

  • April 25, 2016
  • 1 reply
  • 3528 views

I am using the following code that attaches only one file to a PDF.  How could I change my code to allow to attach multiple files?

try {

    var annot = this.addAnnot({

        page: 0,

        type: "FileAttachment",

        point: [500, 500],

        noView: true,

        author: "Attachment"

    });

    annot.cAttachmentPath;

    var attachmentObj = annot.attachment;

    if (attachmentObj !== null) {

        app.alert("Add this file: " + attachmentObj.name);

        var l = this.getField("lst1");

        l.insertItemAt(attachmentObj.name, 0);

    }

}

catch(e) {

    if (e.name == "NotAllowedError") {

        // do nothing

    }

}

This topic has been closed for replies.
Correct answer try67

Run the same code multiple times. You can do it in a for-loop.

1 reply

try67
Community Expert
try67Community ExpertCorrect answer
Community Expert
April 25, 2016

Run the same code multiple times. You can do it in a for-loop.