Home > InDesign Scripts > Move/duplicate pages between documents

Move/duplicate pages between documents

Like you probably know, InDesign can move/duplicate pages within document through scripting, but you can also move/duplicate pages between documents! I found this snippet on Adobe’s InDesign scripting forum, and I tested it and it works just fine!😀

First, we have to declare source and destination documents:

var source_doc = app.documents.item('myTestDoc1.indd');
var destination_doc = app.documents.item('myTestDoc2.indd');

Good, now we have document variables, so, let’s select page we want to move/duplicate.

var sourcePages = source_doc.pages.item(0);

Ok, now ‘sourcePages’ now contains just one page, but what if we want to move/duplicate more than one pages. In that case, we can use itemByRange(); like this:

var sourcePages = source_doc.pages.itemByRange(0,1);

Now we selected page one and page two. Good, now, let’s see first how to move pages to other document.

sourcePages.move(LocationOptions.BEFORE, destination_doc.pages.item(0));

This is little different than moving pages within document because we must set destination document, but ‘.move();’ method reference parameter accepts just page or spread, so we have to pass destination document with destination page like you see in code. In this case, page from source document will be moved to destination document before first page. If you want to move page at the end of destination document you can do this:

sourcePages.move(LocationOptions.AFTER, destination_doc.pages.item(-1));

Also, if you want, you can set binding parameter in move method like this:

sourcePages.move(LocationOptions.BEFORE, destination_doc.pages.item(0), BindingOptions.RIGHT_ALIGN);

Good, now let’s duplicate page from one document to another:

sourcePages.duplicate(LocationOptions.AFTER, destination_doc.pages.item(0));

Again, sourcePages can be single page or multi page. Important thing is that ‘.duplicate();’ method doesn’t have binding parameter!

Yeah, that’s it!

Have fun!😀

  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: