10 Replies Latest reply on Oct 7, 2013 10:15 AM by gkaiseril

    Accessing annotation contents in Reader XI

    zero_divide_1

      I am attempting to write some JavaScript to be able to iterate through the annotations in a document and process each Annotation's contents. I have written the following JavaScript in Acrobat 9 Pro and it outputs the contents fine:

      function onDocumentOpen(document)

      {

          document.syncAnnotScan();

          var annots = document.getAnnots();

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

              var annot = annots[i];

              var content = annot.contents;

              console.println(util.printf("=>annot[%d].contents=\"%s\"", i, content));

          }

      }

       

      onDocumentOpen(this);

      However, when I open the same PDF with the JavaScript in Reader XI, I get this error:

      NotAllowedError: Security settings prevent access to this property or method.

      Markup.contents:7:Document-Level:onDocumentOpen

      According to the Document Restrictions Summary (File > Properties > Security), Commenting in Reader XI is enabled on the document.

       

      Any ideas how I can access the contents and richContents of the Annotations on the document?