Search code examples
javascriptpdfacrobat

Put pdf files in subfolder


I have a acrobat javascript that produces single page pdf files from a multipage pdf file, however I want it it put the output files in a subfolder named single, I cant get it to work, here is my code:

/* Extract Pages to Folder */


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

var filename = this.path.replace(re,"");

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

Solution

  • You just need to set cPath to the fully qualified path you want the file to be saved to. However, in my experience, the subfolder needs to exist first.