7 Replies Latest reply on Dec 12, 2015 12:03 PM by try67

    Extract pages from file and rename

    oscarp35384000

      I have a combined file that I need to break apart into separate files. But I'm having trouble making this work for 2 pages. Let me provide some background. I have a pdf with lets say 10 pages that I need to break into 5 files(F1, F2, F3, F4, F5).  The script below would return 5 files appropriately named but the contents shifted or in some cases duplicated. For Example: F1 would have Pages 1 and 2; F2 would have pages 3 and 4, F3 would have 4 and 5; F4 would have 6  and 7; F5 would have pages 8 and 9.  I'm generalizing here but the gist is that the pages somehow get skewed in the end. Thoughts anyone?


      /* for extracting 2 page pdfs from main file, insert file names in first line between brackets*/


      var filename = ["F1","F2","F3","F4",F5",];


      for (var i = 0; i < this.numPages; i++)

           this.extractPages({

           nStart: i, nEnd: i + 1,

           cPath : filename[i] + ".pdf"

      });