Copy link to clipboard
Copied
I would like to display all the attachments in the document in a list which are attached by addAnnot. For that purpose I created a list which will run below script on mouseUp event.. But whenever the script runs, it basically invalidates the certified document with an invisible signature. I need to prevent any unauthorized modification in the document, for that purpose I created certified document. Any Idea how to make it right or please suggest me if I am doing something wrong as I am new to acrobat development.
var annots = this.getAnnots();
var aAttach = annots.filter(function(a){return (a.type=="FileAttachment");});
for (var i = 0; i < aAttach.length; i++)
attachList.push(aAttach[i].attachment.name);
event.target.setItems(attachList);
Copy link to clipboard
Copied
You need to do this differently. You are preventing all modifications, there aren’t “authorised” modifications. You can’t be Modifying a verified document for any reason, and setitems will do that. Perhaps you can do this immediately before certifying, knowing the list won’t change.
Copy link to clipboard
Copied
https://forums.adobe.com/people/Test+Screen+Name wrote
You need to do this differently. You are preventing all modifications, there aren’t “authorised” modifications. You can’t be Modifying a verified document for any reason, and setitems will do that. Perhaps you can do this immediately before certifying, knowing the list won’t change.
When you add a certification signature, you can specify certain modifications that are allowed without invalidating the signature. Changes like filling form fields, adding annotations, and signing digital signature fields.
Copy link to clipboard
Copied
That's right. I just want to display the attached documents in a list using 'setitem' dynamically whenever new attachments got added. At the same time prevent any modification in the form fields. Since I cannot proceed with both, I think adding an invisible signature before rolling it out to prevent any modifications. I think that will do the job. Correct?
Copy link to clipboard
Copied
You can use a certification signature to prevent any further changes, yes, if that's what you want. I thought you want to allow certain changes after you sent it out though (i.e., adding file attachment comments), which is why I suggested what I did.
Copy link to clipboard
Copied
If you just need to display the list of attachments, you could use either a multiline text field (changing a field's value should be OK), or an app.alert dialog, or even writing to the JavaScript console and displaying it.