Does anyone know where I can get a script that will separate a 50 page PDF into 50 separate files?
Hi Graham
check this out not sure if it will help:
http://www.iis.ee.ic.ac.uk/~g.briscoe/joinPDF/
it looks like there could be an option to split a pdf aswell!!
A short and sweet solution is the java from the reference manual. You can execute in either Acrobat’s batch sequences or AppleScript’s do script. Not yet worked out how to wrap the text of this so I can compile as text within the AppleScript itself.
set MyPDF to choose file with prompt "Where is the multi-page PDF?" without invisibles
set ExtractPages to ((path to desktop) as string) & "Extract_Pages.jsx"
--
tell application "Adobe Acrobat 7.0 Pr#2CB915"
activate
open MyPDF as alias
do script file ExtractPages as alias
close active doc saving no
end tell
The JavaScript
/* Extract Pages to Folder /
// regular expression acquire the base name of file
var re = /./|.pdf$/ig;
// filename is the base name of the file Acrobat is working on
var filename = this.path.replace(re,“”);
try {
for (var i = 0; i < this.numPages; i++) this.extractPages( { nStart: i, cPath: filename+“_0” + (i+1) +“.pdf” }); } catch (e) { console.println("Aborted: "+e) }
This script works great! How about separating a multi-page pdf into 2 page documents (front and back scans for example)?
A neater alternative to the above script with no need for the external java file. Just escaped the relative parts out.
property Default_Path : (path to desktop folder as Unicode text) as alias
property JavaScript : "var re = /.*\\/|\\.pdf$/ig; var filename = this.path.replace(re,\"\"); try { for (var i = 0; i < this.numPages; i++) this.extractPages( { nStart: i, cPath: filename+\"_\" + (i+1) +\".pdf\" }); } catch (e) { console.println(\"Aborted: \"+e) }" as text
set The_PDF to choose file of type "PDF " default location Default_Path ¬
with prompt "Where is the multi-page PDF?" without invisibles
--
tell application "Adobe Acrobat 7.0 Pr#2CB915"
activate
open The_PDF
do script JavaScript
close document 1 saving no
end tell
I did have a reference (but can’t find it now) to a site with lots of alternative JavaScripts for splitting up scanned documents.