29 Replies Latest reply on Oct 12, 2016 2:47 AM by heresha93876846

    Extract pages to separate pdf's (something wrong with loop?)

    jessevictoor Level 1

      Please check following code.

      Acrobat makes duplicates of the original file with all pages in each new generated files instead of the right extracted pages (example: filename_page_2.pdf must be page 2 of the original pdf).

      Another question is that now when the script was running is that at the end of the batch Acrobat asks to save the original file

      What am I doing wrong?

       

       

      /* Extract Pages to Folder */


          var re = /.*\/|\.pdf$/ig;


          var filename = this.path.replace(re,"");
          var lastPage=this.numPages-1;

          {
              for ( var i = 0;  i < this.numPages; i++ )
              this.extractPages
               ({
                  nStart: 0,
                  nEnd: lastPage,
                  cPath : filename + "_page_" + (i+1) + ".pdf"
              });
          };