Hello Forum,
I know there is many Software for splitting one big PDF into more single Pdfs, but I wan´t to do with this a folderscript.
After reading and reading and reading the Documentation from Adobe Java and API I get this script running as a Batch sequence, but I´m not able to make a folderscript with my menuItm tools that makes the same.
Here is the code from my Batchsequence running well:
/* EinzelSeitenEntnehmen */
var re = /\.pdf$/i;
var filename = this.documentFileName.replace(re,"");
try
{
for ( var i = 0; i < this.numPages; i++ )
this.extractPages
({
nStart: i,
cPath: "/c/temp/"+filename+"_00" + (i +1)+".pdf"
});
}
catch (e)
{
console.println("Batch Aborted: " + e )
}
And Here is my folderScript:
/*Extract Pages to Folder*/
// regular expression acquire the base name of file
extractPages = app.trustedFunction(function()
{
var re = /\.pdf$/i;
var filename = this.extractPages.replace(re,"");
try
{
for ( var i = 0; i < this.numPages; i++ )
this.extractPages
({
nStart: i,
cPath: "/c/temp/"+filename+"_" + (i +1)+".pdf"
});
}
catch (e)
{
console.println("Batch Aborted: " + e )
}
}
)
// add the menu item
app.addMenuItem({
cName: "splitpages1JS", // this is the internal name used for this menu item
cUser: "Einzelseiten Trennen", // this is the label that is used to display the menu item
cParent: "Tools", // this is the parent menu. The file menu would use "File"
cExec: "extractPages()",// this is the JavaScript code to execute when this menu item is selected
cEnable: "event.rc = (event.target != null);", // when should this menu item be active?
nPos: 1
});
Acrobat is loading the script with no error in the debugger and I can execute it, but there are no Results in the cPath folder
Please help me again
kind Regards
Gebhard
Try renaming it to something else, like myExtractPages().
- AcrobatUsers Community Expert - Contact me personally at try6767 [at] gmail [dot] com
Check out my custom-made scripts website: http://try67.blogspot.com