Copy link to clipboard
Copied
I am looking for an efficient way to merge two PDFs: one with all odd pages scanned from a book, one with all even pages. This question has been posted many times in many different forums. I am unable to get the Javascript given in the following forum to work. https://forums.adobe.com/thread/286654. Generally, answers to this question are not helpful to me because 1) they provide instructions that apply to an earlier version of Adobe (I’m using Adobe Acrobat Pro DC), or 2) they involve purchasing software that I have found to be ineffective. A step by step post to complete code that can do the job and be pasted and saved as a custom command through the command Wizard (see the Jan 13, 2016 11:27 AM post at https://forums.adobe.com/thread/2063936, for an example of a good answer to a different question) would be much appreciated. Thanks, Carl
You can use a big portion of the script that was posted in the other thread and create a custom command out of it. It actually makes the script easier to understand, because all the "stuff" that is about adding menus and elevating the scripts rights is not necessary anymore.
See here for instructions about how to create a custom command in Acrobat DC:
Create Custom Commands in Adobe Acrobat DC Pro - KHKonsulting LLC
Instead of the sample code from the blog post, you would use this (which is really
...Copy link to clipboard
Copied
Well, if you're interested in a tool that is guaranteed to do it, and is compatible with Acrobat DC (although it's not free), check out this one I've developed: Custom-made Adobe Scripts: Acrobat -- Combine Even-Odd Pages
Copy link to clipboard
Copied
You can use a big portion of the script that was posted in the other thread and create a custom command out of it. It actually makes the script easier to understand, because all the "stuff" that is about adding menus and elevating the scripts rights is not necessary anymore.
See here for instructions about how to create a custom command in Acrobat DC:
Create Custom Commands in Adobe Acrobat DC Pro - KHKonsulting LLC
Instead of the sample code from the blog post, you would use this (which is really just a copy&paste from the original script):
// 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");
Given the instructions in my blog post, you should be able to create this custom command and run it. For running it, the important part is that you load the "odd" part of the document first, then start the custom command and then select the "even" part of the document.
Copy link to clipboard
Copied
Hi Karl,
Thanks for making that so incredibly easy, that worked perfectly.
Carl
Copy link to clipboard
Copied
Hi Karl,
Is there a way to do this with Adobe Acrobat Standard DC?
thanks,
Michelle
Copy link to clipboard
Copied
All of the solutions described above should work with Acrobat Standard DC. I know that my tool (linked to above) does.
Copy link to clipboard
Copied
Actions (and because of that I assume custom commands) are a Pro only feature, so you would not have access to the same simple setup I outlined. For the Standard version, you would have to use the original approach described here: Combining an even pages file and an odd pages file into one PDF achieving propper order
I just tested the script from that thread, and it works with Adobe Acrobat DC - you end up with two new menu items in the "Edit" menu. You want to use the "Collate" menu with the "odd" document already loaded in Acrobat. It will then prompt you to select the "even" document and combine the two.
Copy link to clipboard
Copied
I don't know if I'm just not doing this correctly or if it just doesn't work this way in my version, but it doesn't seem to be working for me in Acrobat Pro XI. Also I'm looking for a slightly more complicated collation method. Basically I need to combine page 1 from document 1, with pages 2 and 3 from document 2, and so on to the end of the documents.
Copy link to clipboard
Copied
What problems are you running into with Acrobat XI Pro? Which script are you using? You will have to modify the script to get the behavior you want. With a little background in JavaScript, it should not be a problem to adjust the script.
Copy link to clipboard
Copied
Actually, I got it to work now, action created, its my first time using javascript in a pdf. And I misworded the original, I need page 1 from doc 1 and pages 1&2 from doc 2, and so on.
Copy link to clipboard
Copied
Thank you so much for this answer; definitely saves me a lot of time (I had to manually sort through the odd and even pages before). Confirming that this solution still works for Adobe Acrobat Pro DC in 2021.
Copy link to clipboard
Copied
@Karl Heinz Kremer this script is still running strong in 2021. Your process worked flawlessly and is greatly appreciated--that's 78 pages I didn't have to spend time manually rearranging. Thank you.
Software: Acrobat Pro DC
Copy link to clipboard
Copied
just incredible! thank you Karl!
Copy link to clipboard
Copied
Hi Karl,
I've been searching (unsuccesfully so far) to find a way to merge two documents, but collate them such that each page from Document B is inserted just after a certain page in Document A. Perhaps after every page that has the word "Apple" on it from Document A.
For example:
A1 (has the word "Apple")
B1
A2
A3
A4 (has the word "Apple")
B2
A5 (has the word "Apple")
B3
A6
A7 (has the word "Apple")
B4
I'm sure there is a way to make this happen, I'm just very rusty with coding. If you have any tips for me to look into, I would be appreciative!
thank you!
Katie
Copy link to clipboard
Copied
The two things are quite different and will require different approaches. The latter is much more complicated, of course.
Copy link to clipboard
Copied
One small point, which is obvious (but an idiot like me missed it): both documents need to have the same number of pages. If you didn't scan the last page because it was blank, the script will hang forever.
Copy link to clipboard
Copied
It is not working for me.
It is only inserting the first page of the document 2 in the document 1, nothing more.
Can you help me, Karl Heinz Kremer ?
Does anyone else know what the problem is?
Copy link to clipboard
Copied
It worked for everybody else, so I would assume there is something wrong with your code. Are you getting any errors on the JavaScript console?