Star InactiveStar InactiveStar InactiveStar InactiveStar Inactive
 

If you ever scanned documents into a PDF and now you have two sets of PDFs; one with odd number pages and the other with even number page in reverse order and you want to make them merge into one PDF with the correct ordering then you will not be able to do this easily in Adobe DC unless you enable scripts.

First you will need to allow JavaScript to be ran in Adobe  Acrobat Pro DC 

Click Edit menu, then Preferences.

Left hand side click JavaScript

Check Enable Acrobat JavaScript

Check Enable menu items JavaScript execution privileges

Check Enable global object security policy

 

Close Adobe Acrobat Pro

In windows go to the folder: C:\Program Files (x86)\Adobe\Acrobat DC\Acrobat\Javascripts

and copy the attached file to that directory

or Copy the code below and save in a file called CollateAndOrder.js

 

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();	
}


trustedCollatePages = app.trustedFunction(function()
{
  app.beginPriv();

  var arRect = new Array();
  arRect[0] = 0;
  arRect[1] = 0;
  arRect[2] = 0;
  arRect[3] = 0;


  var f = this.addField("txtFilename", "text", this.numPages - 1, arRect);

  f.delay = true;
  f.fileSelect = true;
  f.delay = false;



  f.browseForFileToSubmit();
  if(f.value==null || f.value == ''){
	   app.alert("You didn't select a PDF file to collate with.");
  }else{
	  var fileExt = f.value.substr((~-f.value.lastIndexOf(".") >>> 0) + 2);
	  if(fileExt.toLowerCase() != "pdf"){
		  app.alert("You must select a PDF file type.");
	  }else{
		  var evenDocPath = f.value;

		  var q = this.numPages;

		  for (var i = 0;i < q; i++) {
			  var j = i*2;
			  this.insertPages(j, evenDocPath, i);
		  } 
		  app.alert("Collate complete.");
	  }
  }
  this.removeField("txtFilename");
  app.endPriv();
})

You will first want to open the file you need to sort or reverse order.

Open the the PDF and go to the Edit menu and click Reverse. Make sure your pages are in the correct order and save.

Close that file and now open the PDF with the first page number. Click Collate and select the PDF with the other set of pages and click OK. Now save it. Done!