Based on an example script provided by Adobe.

Adobe’s PDF documentation for Batch Sequences ]
Further documentation and Acrobat SDKs at Adobe ]
[ Good Acrobat JavaScript prefs (main required settings are on by default – but you can take the opportunity to enable debugging too) ]

You’ll need to put the example file into your user sequences folder.
Mine is ~/Library/Application Support/Adobe/Acrobat/9.0_x86/Sequences/.

To find yours you may need to run
app.getPath(“user”,”sequences”);

To run JavaScript
Open Console Advanced/Document Processing/JavaScript Debugger… (or Command + J)
Paste in your JS and to run it [Enter] or [Command + Return]

Code below.

I’ve changed two things on line 11
cPath “ExtractedPages” is the name of the subfolder I want these files saved into. This folder relative to the original files.
I’ve changed +filename+”_”+i+”.pdf” to +filename+”_p”+(i+1)+”.pdf” so that pages extracted show their page numbers with a “p” starting at 1 rather than 0

/* Extract Pages to Folder TEST */
// A regular expression to acquire the base name of the file.
var re = /.*\/|\.pdf$/ig;
var filename = this.path.replace(re,"");
try
{
for ( var i = 0; i < this.numPages; i++ )
this.extractPages
({
nStart: i,
cPath: "ExtractedPages/"+filename+"_p"+(i+1)+".pdf" // change this
});
}
catch (e)
{
console.println("Batch Aborted: " + e )
}

NB it doesn’t work if you want fully cloned PDF/X-1a copies…
As noted by Acrobat guru Jon Bessant in this thread on extracting pages from PDF/X “correct PDF version, CGAT tag and output intent” will be missing.


Other references:
http://acrobatusers.com/forum/javascript/batch-extract-multiple-pages-pdf/

Last updated on 5th September 2018