Automate merge pdf files
Copy link to clipboard
Copied
We are looking to automate a task to merge two pdf files each with the same number of pages, into one pdf file in a specific order, not adding one file to the end of another. We want to create one pdf file from the two pdf files by putting each page of the second pdf file after each page of the first pdf file. A1, B1, A2, B2, A3, B3 etc. It seems an easy task, but with 100 pages manually moving one at a time is possible, but not really a good use of time, and prone to errors if the operative isnt concentrating.
One option might be to export each page in each file to a separate 1 page doc, Doc A to 1,3,5,7,9 etc, and Doc B to 2,4,6,8,10 and then import one after the other back in to one file.
other than that I need to find some way of zippering it together by page number.
Any pointers would be appreciated.
Copy link to clipboard
Copied
Search the forum for:
merge odd even pages
Copy link to clipboard
Copied
Thankyou will take a look
Copy link to clipboard
Copied
Hello,
you can create the an Action Wizard Action adding in the Exacute Javascript tool with the below code pasted into the tools window. I tested and it does exactly what you're looking to do.
Below is the post where this was found and copied from.
// 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");
Regards,
Mike
Copy link to clipboard
Copied
Thankyou
will give this a go today

