Copy link to clipboard
Copied
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Hi Bernd, thanks for posting this. Can you explain where to place the script? Sorry--my first time around with this. The site says to use the Javascript Debugger... not just create this as a script?
Thanks
JP
Copy link to clipboard
Copied
You can execute the code in the Javascript Debugger.
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Copy link to clipboard
Copied
There is a simple application I wrote, which provide a solution for that
problem exactly. It is completly free, although you are more than
welcome to donate in the site 🙂
Copy link to clipboard
Copied
I've attached a script that adds two menu items into the "Tools" menu. "Collate" merges even and odd pages, and "Reverse" will as reverse the order of the pages in a PDF.
To install it, exit Acrobat. Save the script into Acrobat's Javascripts directory (e.g. C:\Program Files\Adobe\Acrobat 8.0\Acrobat\Javascripts ), and restart Acrobat.
I hope you find this script useful!
Copy link to clipboard
Copied
was downloaded and placed in the following folder:
C:\Program Files (x86)\Adobe\Acrobat 9.0\Acrobat\Javascripts
It worked as described by “JBAITIS”.
Had to open first the PDF file having ODD pages, in Acrobat9.
Next from “TOOLS” selected “COLLATE”.
After a brief error message, the name of the second PDF file having all EVEN pages was selected.
Clicked OK and done!
NB: for “COLLATE” to work you have to open a PDF file first, preferably the odd-pages PDF file.
Thank you “JBAITIS” for a GREAT and essential time-saver program, and thank you all.
Dan
Copy link to clipboard
Copied
Here is the latest version of this script, compabible with Acrobat X. The functions have been moved into the "Edit" menu because there is no tools menu in Acrobat X. It still maintains compatibility with Acrobat 9. Unfortunately, you'll have to manually copy and paste this into a file because Adobe has disabled the file attachment feature on Jive Forums.
// Complements: Planet PDF (http://www.planetpdf.com/)
// Modified by Jeff Baitis for Acrobat 9 and Acrobat X compatibility
// Improved Collate function with status bar.
// Add a menu item to reverse all pages in the active document
app.addMenuItem({ cName: "Reverse", cParent: "Edit", cExec: "trustedReversePages();", cEnable: "event.rc = (event.target != null);", nPos: 0 });
// Add a menu item to collate with another document on the filesystem
app.addMenuItem({ cName: "Collate", cParent: "Edit", cExec: "trustedCollatePages();", cEnable: "event.rc = (event.target != null);", nPos: 0 });
trustedReversePages = app.trustedFunction(function()
{
app.beginPriv(); // Explicitly raise privileges
var t = app.thermometer;
t.duration = this.numPages;
t.begin();
for (i = this.numPages - 1; i >= 0; i--)
{
t.value = (i-this.numPages)*-1;
this.movePage(i);
t.text = 'Moving page ' + (i + 1);
}
t.end();
app.endPriv();
})
// Collating pages
/*
Title: Collate Document
Purpose: User is prompted to select document to insert/collate.
Author: Sean Stewart, ARTS PDF, www.artspdf.com
*/
trustedCollatePages = app.trustedFunction(function()
{
app.beginPriv(); // Explicitly raise privileges
// create an array to use as the rect parameter in the browse for field
var arRect = new Array();
arRect[0] = 0;
arRect[1] = 0;
arRect[2] = 0;
arRect[3] = 0;
// create a non-visible form field to use as a browse for field
var f = this.addField("txtFilename", "text", this.numPages - 1, arRect);
f.delay = true;
f.fileSelect = true;
f.delay = false;
// user prompted to select file to collate the open document with
app.alert("Select the PDF file to merge with")
// open the browse for dialog
f.browseForFileToSubmit();
var evenDocPath = f.value;
var q = this.numPages;
var t = app.thermometer;
t.duration = q;
t.begin();
// insert pages from selected document into open document
for (var i = 0; i < q; i++) {
var j = i*2;
this.insertPages(j, evenDocPath, i);
t.value = i;
t.text = 'Inserting page ' + (i+1);
}
t.end();
// remove unused field
this.removeField("txtFilename");
app.endPriv();
})
Copy link to clipboard
Copied
This js file is exactly what I needed but I'd like to added it the batch processing function. unfortunately when i copy the script and put it into the js sequence, it appears to run successfully but after i select the file to add, nothing happens. any ideas?
Copy link to clipboard
Copied
Wowie wow! This is what I've been pulling my hair out over for ages! Thank you so much for this JavaScript script. It works wonderfully and since I just wrote up a file for myself on installing and using it on a Mac, I thought I'd just copy/paste it here for other Mac users who are using Acrobat Pro X and need to collate their files. Hope this helps other Mac users:
So, for Macintosh users, there are Two Big Steps:
Big Step 1:
The CollatePages.js file has to be placed in
~/Library/Application Support/Adobe/Acrobat/10.0/JavaScripts
folder. To create the file, you can simply copy the script above then paste it into Textedit (make it a plain text file). See important note 2 below for naming it.
Five Important Notes:
Big Step 2:
In Acrobat Pro, you collate two files: The odd pages file needs to be already open and the even pages file is opened using the Collate command (now under Edit in the menubar as the picture in Note 3 above shows). The file that gets added (presumably the even pages) gets interweaved with the first (already open) file starting at the second page.
If you have separate files for each page (either because they were scanned in separately or they were extracted within Acrobat to separate files) then you first need to combine them into one file for odds and evens.
The Reverse command simply reverses the page order of the open file; possibly helpful if a source file has its pages in the opposite order before collating.
Last, you could, if you want to, click on Yes (this was helpful) below.
Copy link to clipboard
Copied
These instructions were almost prefect, but in order to get it to work with XI,@ I modified the script. ( changed it from the "Tools" to "Edit" menu. and it shows up under Edit! )
// Complements: Planet PDF (http://www.planetpdf.com/)
// Modified by Christian Sass for Acrobat XI compatibility
// Add a menu item to reverse all pages in the active document
app.addMenuItem({ cName: "Reverse", cParent: "Edit", cExec: "PPReversePages();", cEnable: "event.rc = (event.target != null);", nPos: 0 });
app.addMenuItem({ cName: "Collate", cParent: "Edit", cExec: "trustedCollatePages();", cEnable: "event.rc = (event.target != null);", nPos: 0 });
function PPReversePages()
{
var t = app.thermometer;
t.duration = this.numPages;
t.begin();
for (i = this.numPages - 1; i >= 0; i--)
{
t.value = (i-this.numPages)*-1;
this.movePage(i);
t.text = 'Moving page ' + (i + 1);
}
t.end();
}
// Collating pages
/*
Title: Collate Document
Purpose: User is prompted to select document to insert/collate.
Author: Sean Stewart, ARTS PDF, www.artspdf.com
*/
trustedCollatePages = app.trustedFunction(function()
{
app.beginPriv(); // Explicitly raise privileges
// create an array to use as the rect parameter in the browse for field
var arRect = new Array();
arRect[0] = 0;
arRect[1] = 0;
arRect[2] = 0;
arRect[3] = 0;
// create a non-visible form field to use as a browse for field
var f = this.addField("txtFilename", "text", this.numPages - 1, arRect);
f.delay = true;
f.fileSelect = true;
f.delay = false;
// user prompted to select file to collate the open document with
app.alert("Select the PDF file to merge with")
// open the browse for dialog
f.browseForFileToSubmit();
var evenDocPath = f.value;
var q = this.numPages;
// insert pages from selected document into open document
for (var i = 0;i < q; i++) {
var j = i*2;
this.insertPages(j, evenDocPath, i);
}
// remove unused field
this.removeField("txtFilename");
app.endPriv();
})
Copy link to clipboard
Copied
Is there a way to get just the Collate part of the script as an Action in the Action Wizard? I've tried copying and pasting parts into a new action without success. I do not need the reverse function. Thanks.
Copy link to clipboard
Copied
Hi sastian, I know this is old, but can you tell me *where* to put this javascript?
I can run the reorder function by putting it in Actions, but the combine/coallate function doesn't work in Actions for whatever reason. And anyway, having the buttons under "edit" would work much better overall. (I hate the Acrobat XI design!)
I tried copying the whole thing into a txt file and renamed it reorder.js and copied to the JSCache folder under Users Roaming (etc), but that didn't work at all.
Thanks!
--d
Edit: Nevermind. I figured out how to run the java console, struggled with how to run the script (why is there no run command?????), and discovered that the following is the path to have this script run (permanently, under Edit) in Acrobat. I still don't understand why Adobe insists on giving us these STUPID headaches!
C:\Program Files (x86)\Adobe\Acrobat 11.0\Acrobat\Javascripts
Copy link to clipboard
Copied
Thank you for this, but unfortunately I cannot get it to work with Acrobat XI Standard. I can't believe that Adobe still hasn't made this a feature.
Copy link to clipboard
Copied
Did you look at the Planet PDF solution? For Acrobat X and XI you need to install the per
Copy link to clipboard
Copied
Thank you, GKaiseril! Yes, I looked at the Planet PDF solution but was unable to get it to work. The link you gave says that the new location for the JS is going to be Users\(username)\AppData\Roaming\Adobe\Acrobat\Privileged\10.0\JavaScripts, however, after C:\Users\Mark\AppData\Roaming\Adobe\Acrobat I have no folder called "Priviledged". I turned on "Hidden Items". Maybe this is because I have Windows 8, I'm not sure. I can get to C:\Users\Mark\AppData\Roaming\Adobe\Acrobat\11.0 but there's no "Priviledged" folder there either. Nor is there any "JavaScripts" folder. I don't know where to go from here.
Copy link to clipboard
Copied
You can run the code using the JavaScript console for a one time use.
Open the odd pages PDF.
Open the JavaScript Console, "Ctrl + J.
Copy and paste the revised script to the console window.
Select all the text in the console window.
Use the Ctrl + Numeric Keypad Enter key to run the code.
You should now have the new menu options until you restart Acrobat.
I would move the code to add the menu items to after the creation of the trusted functions.
Copy link to clipboard
Copied
Thank you again, GKaiseril. This is a bit frustrating. Ctrl+J does not open the JavaScript Console. I took a look at http://acrobatusers.com/tutorials/javascript_console and it says that you can also get there using Advanced>JavaScript>Debugger, but I can't find the "Advanced" menu item either. I'm running Adobe Acrobat XI v11.0.2 if that helps. Any other ideas?
Copy link to clipboard
Copied
Almost all the menu items moved to the TOOLS button in Acrobat X. So JavaScript options are there for you.
Copy link to clipboard
Copied
I found the Tools button, but there is nothing there relating to JavaScript. I have "content editing", "pages", "interactive objects", "forms", "text recognition" and "protection". I've clicked on all of them and there is nothing. I also found a Common Tools button but there is nothing there either.
Copy link to clipboard
Copied
Above those tools, and below the Tools button, is a little icon. I can't describe it, but you should be able to find it. Click on it and you'll see you can turn on a whole lot more options (it will list Content Editing, Pages, etc. with a tick).
Copy link to clipboard
Copied
Thank you again. I'm getting close to giving up here, however. I found the JavaScript button which has a button "Set document actions". When I press it I get a box that says, "When this happens..." with options like "Document will close" and "Document will save." I opened up a couple of them and pasted in the JS and tried to run it, but nothing happened.