you should duplicate/move a spread instead of a page.
try simply modify around L18 - 20 like below.
var source_doc = app.open(source_file); var sourceSpreads = app.activeDocument.spreads.item(0); sourceSpreads.duplicate(LocationOptions.AFTER, source_doc.spreads.item(0)); sourceSpreads.move(LocationOptions.AFTER, destination_doc.spreads.item(-1)); app.activeDocument.close(SaveOptions.NO);
Your answers here Re: Pages sticking together after moving to a different document
This is a summary
I added an extra page before duplicating the odd size page and then I removed the page with myPage.Remove()
I added a page to the destination document and then deleted it after I was done adding the pages, and it worked!!!
Thank you very much Trevor, you're the man!
In other words use this process (pseudocode)
var tempPage = doc.pages.add();
sourcePage.move / duplicate (etc...);
Hi Legends (Milli/Trevor),
First of all., Thank you for spending valuable time for me....
Milli: I tested your code, it is working for me.
Trevor: Still not tested. Hope your code always works well for me.
Again thanks a lot!!!
Yep, in your cases milligrams solution is much better