Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
1

Move all pages of one document to another.

Advocate ,
Sep 22, 2017 Sep 22, 2017

Hi all,

Using javascript I tried to move all pages from a document to another, I found method name move

//~ var sourcePages = source_doc.pages.itemByRange(myDocFirstPage, myDocLastPage);

var sourcePages = source_doc.pages.everyItem();

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

Error:

Move_Pages_01.JPG

But I want to know how to use all pages method as per below snapshot.

I want to move all pages without deleting.

Move_Pages.JPG

Thanks & Regards

Sunil Y.

TOPICS
Scripting
3.0K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Sep 22, 2017 Sep 22, 2017

If you dont want to delete, then instead of move use duplicate method

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Sep 22, 2017 Sep 22, 2017

But when I use duplicate method for a large file, it takes longer time to execute.

I want to use "Move pages" method.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Sep 22, 2017 Sep 22, 2017
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Sep 22, 2017 Sep 22, 2017

this one works.. but need to give the page range for the source document.. because we cant move all the pages..it need atleast one

var sourcePages = app.documents[0];

sourcePages.pages.itemByRange(1,1).move(LocationOptions.AFTER, app.documents[1].pages.item(-1));

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Sep 22, 2017 Sep 22, 2017

Great efforts sir, I appreciate it, but I do not want to give page range too and don't want to write long code for assigning page ranges, instead simply want to move all pages without range and without deleting pages.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Sep 22, 2017 Sep 22, 2017

Then you have to stick with duplicate method.. this will work

var sourcePages = app.documents[0]; 

sourcePages.pages.everyItem().duplicate(LocationOptions.AFTER, app.documents[1].pages.item(-1));

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Sep 22, 2017 Sep 22, 2017
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Sep 22, 2017 Sep 22, 2017

Hi,

hope its may helps to you!!!

var source_doc = app.documents.item('source_file.indd'); 

var destination_doc = app.documents.item('destination_file.indd')

var sourceSpreads = app.activeDocument.spreads.everyItem();   

sourceSpreads.duplicate(LocationOptions.AFTER, source_doc.spreads.item(-1));

Thanks,

Prabu

Thanks,
Prabu
Design smarter, faster, and bolder with InDesign scripting.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Sep 22, 2017 Sep 22, 2017

Prabhu, he said he dont want to use duplicate method

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Sep 25, 2017 Sep 25, 2017

Prabu, I want to move all pages using "All Pages" instead of page range and uncheck "Delete Pages After Moving" using script, because duplicate method first saves all data in a variable then paste, that results into time delay if files which are longer and contains heavy images...

Thanks,

Sunil Y.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Sep 30, 2021 Sep 30, 2021
LATEST

hey sunil 

 

i have facing same script problem,i want move all the spread from one indesign document to another (1 spread (2 facing page) ind document ,can you please help .It would great help .

 

sukriti

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines