Quantcast
Channel: Adobe Community : Popular Discussions - JavaScript
Viewing all articles
Browse latest Browse all 12130

Javascript help for newbie

$
0
0

Hi,

I have a 18x12 booklet form PDF (each PDF page consists of 2 9x12 images) that I need to split into single 9x12 pages.

Found 2 scripts on the net to split pages in Acrobat and the other one to reorder the split pages. (after splitting the pages one ends up with page 1, page 24, page 2, page 23, etc.) Need to reorder the pages and found the Reorder script below.

But it doesn't work in Acrobat 9 - I'm getting an illegal character error in line 20. (seems to be this line? nStart: i * 4 – 3).

I don't even get a menu item called Reorder Pages under Documents.

Help?

 

 

Script:

ReorderDocument = app.trustedFunction(function()

{

// create a new document

app.beginPriv();

var newDoc = app.newDoc();

app.endPriv();

 

// reorder pages in booklet order into new document in sequential order

 

var i = 0;

 

var n = this.numPages;

 

for (var i = 1; i <= n / 4; i++)

 

{

newDoc.insertPages( {

nPage: newDoc.numPages-1,

cPath: this.path,

nStart: i * 4 – 3,

nEnd: i * 4 – 2

});

}

 

newDoc.insertPages( {

nPage: newDoc.numPages – 1,

cPath: this.path,

nStart: n – 1

});

 

for (var i = 1; i 1)

 

{

newDoc.deletePages(0); // this gets rid of the page that was created with the newDoc call.

}

 

})

 

// add the menu item

app.addMenuItem({

cName: "reorderPagesJS", // this is the internal name used for this menu item

cUser: "Reorder Pages", // this is the label that is used to display the menu item

cParent: "Document", // this is the parent menu. The file menu would use "File"

cExec: "ReorderDocument()", // 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

});


Viewing all articles
Browse latest Browse all 12130

Trending Articles