Skip to main content
Participating Frequently
September 30, 2018
Question

JavaScript invalidates the certified document

  • September 30, 2018
  • 2 replies
  • 436 views

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.

attachList = [];

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

This topic has been closed for replies.

2 replies

Inspiring
October 1, 2018

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.

Legend
September 30, 2018

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.

Inspiring
October 1, 2018

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.

Participating Frequently
October 1, 2018

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?