Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Destroy Annotations by Javascript

ditto9888
Level 4
Level 4

Hi, I have a piece of Javascript (pretty much copied from Acrobat manual) that's attached to the Click event of a Button, and it removes all the annotations on a PDF form.

The script is like this:

var oObj = event.target;

var annots = oObj.getAnnots({ nPage:0 });

for (var i = 0; i < annots.length; i++) {

  annots[i].destroy();

  }

It works fine when the form is a stand-alone PDF.  But when I put the form in the WorkSpace and get it routed in a workflow, it doesn't remove the annotations at all.

(The form is referenced by a Document variable in the Process, and it's the input/outpt of the User Tasks.)

What do I need to do to get it to work in WorkSpace?

thanks

0 Replies
dohanlon
Level 5
Level 5

Tried this out using a pdf in a process flow. Added the button with your code to the form and then opened it in workspace. Added some comments and then was able to remove all comments from the list using the button. The only thing I can think of is that comments can only be used on static pdf forms. Goto File->Form Properties->Defaults and make sure PDF render format is Static PDF Form.

Otherwise see if you can see any exception being thrown in either the acrobat javascript console or try..catch. Maybe uploading/publish a sample somewhere to see if there is something else.

ditto9888
Level 4
Level 4

thanks.  it's working now.  there was a scripting bug.