Check if this script works for you.
var MultipleOf = 4;
var OverwriteSourceFile = false;
/******************************************************************************
Leave empty to save the changed files into the source folder.
Fill it with a folder path, e.g. var DestFolder ="c:\\PDFs\\Processed\\"; to
specify a fixed save to folder.*/
var DestFolder = "";
/******************************************************************************/
var Merger = pdfe.CreateDocumentMerger();
var ProgressBar = pdfe.ProgressBar;
ProgressBar.max = pdfe.SelectedFiles.Count;
for (var i = 0; i < pdfe.SelectedFiles.Count; i++) {
var File = pdfe.SelectedFiles(i);
var Filename = File.Filename;
pdfe.echo(Filename);
ProgressBar.position = i + 1;
var BlanksNeeded = MultipleOf - File.NumPages % MultipleOf;
if (BlanksNeeded < MultipleOf) {
Merger.MergeDocument(Filename);
var LastPage = File.pages(File.pages.count - 1);
for (var n = 0; n < BlanksNeeded; n++)
Merger.MergeBlankPage(LastPage.width, LastPage.height);
File.close();
if (DestFolder) {
NewFilename = DestFolder + Filename.substr(Filename.lastIndexOf('\\') + 1);
} else if (OverwriteSourceFile) {
var NewFilename = Filename;
} else {
NewFilename = Filename.substring(0, Filename.lastIndexOf('.')) + '_' + (BlanksNeeded) + 'BlanksAdded.pdf';
}
Merger.EndAndSaveTo(NewFilename);
pdfe.echo(' : ' + (BlanksNeeded) + ' blank pages added', 0, true);
} else pdfe.echo(' : Already multiple of ' + MultipleOf, 0, true);
}
pdfe.echo('All done.');