11 Replies Latest reply on Feb 10, 2016 12:06 PM by Christianhchuk

    Acrobat Pro XI Java: Deleting Page is Very Slow

    Christianhchuk Level 1

      Hi Everyone,

       

      Below is a set of code I got working in Acrobat XI to pull up a popup window that, when the user selects yes, is able to search for a hidden keyword on certain pages in the PDF and then delete the corresponding pages.  This works, but the problem is that it takes almost a minute to process.  I would love someone's input as to what might be slowing the process down.  I am very new to Java so any specific suggestions would be greatly appreciated!

       

      Thank you in advance,

      Christian

       

      var cMsg = "Continuing with the current action will remove the CHES application and its data.  This operation may take a minute to complete.";

      cMsg += "\n\nDo you want to continue?";

      var nRtn = app.alert(cMsg,2,2,"Question Alert Box");

      if(nRtn == 4)

      {// A yes Response

        // Code for doing the thing you do on a yes

        console.println("The Response Was Yes");

      for (var p=this.numPages-1; p>=0; p--) {

          for (var n=0; n<this.getPageNumWords(p); n++) {

             if (this.getPageNthWord(p, n) == "CHESDELETE") {

              this.deletePages(p);

              break;

      }

      }

      }

      }

       

      else if(nRtn == 3)

      {//No Response

      console.println("The Response Was No");

      }

       

      else  

      { //Unknown Response

        console.println("The Response Was somthing other than Yes/No: " + nRtn);

      }